Package com.automation_pros.odva.endian
Class EndianOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- com.automation_pros.odva.endian.EndianOutputStream
-
- All Implemented Interfaces:
EndianDataOutput
,java.io.Closeable
,java.io.DataOutput
,java.io.Flushable
,java.lang.AutoCloseable
public class EndianOutputStream extends java.io.OutputStream implements EndianDataOutput
-
-
Constructor Summary
Constructors Constructor Description EndianOutputStream(java.io.OutputStream out)
Wrap any otherOutputStream
to provide both little-endian and big-endian data output operations.EndianOutputStream(java.io.OutputStream out, int skip)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
checkWriteSkip(int n)
void
close()
void
flush()
void
write(byte[] src)
void
write(byte[] src, int offset, int length)
void
write(int b)
void
writeBoolean(boolean v)
void
writeByte(int v)
void
writeBytes(java.lang.String s)
void
writeChar(int v)
void
writeCharLE(int v)
Little-endian counterpart towriteChar()
.void
writeChars(java.lang.String s)
void
writeCharsLE(java.lang.String s)
Little-endian counterpart towriteChars()
.void
writeDouble(double v)
void
writeDoubleLE(double v)
Little-endian counterpart towriteDouble()
.void
writeFloat(float v)
void
writeFloatLE(float f)
Little-endian counterpart towriteFloat()
.void
writeInt(int v)
void
writeIntLE(int v)
Little-endian counterpart towriteInt()
.void
writeLong(long v)
void
writeLongLE(long v)
Little-endian counterpart towriteLong()
.void
writeShort(int v)
void
writeShortLE(int v)
Little-endian counterpart towriteShort()
.void
writeUTF(java.lang.String s)
-
-
-
Constructor Detail
-
EndianOutputStream
public EndianOutputStream(java.io.OutputStream out)
Wrap any otherOutputStream
to provide both little-endian and big-endian data output operations.- Parameters:
out
- The stream to wrap.
-
EndianOutputStream
public EndianOutputStream(java.io.OutputStream out, int skip)
-
-
Method Detail
-
write
public void write(int b) throws java.io.IOException
- Specified by:
write
in interfacejava.io.DataOutput
- Specified by:
write
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
write
public void write(byte[] src) throws java.io.IOException
- Specified by:
write
in interfacejava.io.DataOutput
- Overrides:
write
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
write
public void write(byte[] src, int offset, int length) throws java.io.IOException
- Specified by:
write
in interfacejava.io.DataOutput
- Overrides:
write
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOException
- Specified by:
flush
in interfacejava.io.Flushable
- Overrides:
flush
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
writeBoolean
public void writeBoolean(boolean v) throws java.io.IOException
- Specified by:
writeBoolean
in interfacejava.io.DataOutput
- Throws:
java.io.IOException
-
writeByte
public void writeByte(int v) throws java.io.IOException
- Specified by:
writeByte
in interfacejava.io.DataOutput
- Throws:
java.io.IOException
-
checkWriteSkip
protected boolean checkWriteSkip(int n) throws java.io.IOException
- Throws:
java.io.IOException
-
writeShort
public void writeShort(int v) throws java.io.IOException
- Specified by:
writeShort
in interfacejava.io.DataOutput
- Throws:
java.io.IOException
-
writeChar
public void writeChar(int v) throws java.io.IOException
- Specified by:
writeChar
in interfacejava.io.DataOutput
- Throws:
java.io.IOException
-
writeInt
public void writeInt(int v) throws java.io.IOException
- Specified by:
writeInt
in interfacejava.io.DataOutput
- Throws:
java.io.IOException
-
writeLong
public void writeLong(long v) throws java.io.IOException
- Specified by:
writeLong
in interfacejava.io.DataOutput
- Throws:
java.io.IOException
-
writeFloat
public void writeFloat(float v) throws java.io.IOException
- Specified by:
writeFloat
in interfacejava.io.DataOutput
- Throws:
java.io.IOException
-
writeDouble
public void writeDouble(double v) throws java.io.IOException
- Specified by:
writeDouble
in interfacejava.io.DataOutput
- Throws:
java.io.IOException
-
writeBytes
public void writeBytes(java.lang.String s) throws java.io.IOException
- Specified by:
writeBytes
in interfacejava.io.DataOutput
- Throws:
java.io.IOException
-
writeChars
public void writeChars(java.lang.String s) throws java.io.IOException
- Specified by:
writeChars
in interfacejava.io.DataOutput
- Throws:
java.io.IOException
-
writeUTF
public void writeUTF(java.lang.String s) throws java.io.IOException
- Specified by:
writeUTF
in interfacejava.io.DataOutput
- Throws:
java.io.IOException
-
writeCharLE
public void writeCharLE(int v) throws java.io.IOException
Description copied from interface:EndianDataOutput
Little-endian counterpart towriteChar()
.- Specified by:
writeCharLE
in interfaceEndianDataOutput
- Throws:
java.io.IOException
-
writeCharsLE
public void writeCharsLE(java.lang.String s) throws java.io.IOException
Description copied from interface:EndianDataOutput
Little-endian counterpart towriteChars()
.- Specified by:
writeCharsLE
in interfaceEndianDataOutput
- Throws:
java.io.IOException
-
writeDoubleLE
public void writeDoubleLE(double v) throws java.io.IOException
Description copied from interface:EndianDataOutput
Little-endian counterpart towriteDouble()
.- Specified by:
writeDoubleLE
in interfaceEndianDataOutput
- Throws:
java.io.IOException
-
writeFloatLE
public void writeFloatLE(float f) throws java.io.IOException
Description copied from interface:EndianDataOutput
Little-endian counterpart towriteFloat()
.- Specified by:
writeFloatLE
in interfaceEndianDataOutput
- Throws:
java.io.IOException
-
writeShortLE
public void writeShortLE(int v) throws java.io.IOException
Description copied from interface:EndianDataOutput
Little-endian counterpart towriteShort()
.- Specified by:
writeShortLE
in interfaceEndianDataOutput
- Throws:
java.io.IOException
-
writeIntLE
public void writeIntLE(int v) throws java.io.IOException
Description copied from interface:EndianDataOutput
Little-endian counterpart towriteInt()
.- Specified by:
writeIntLE
in interfaceEndianDataOutput
- Throws:
java.io.IOException
-
writeLongLE
public void writeLongLE(long v) throws java.io.IOException
Description copied from interface:EndianDataOutput
Little-endian counterpart towriteLong()
.- Specified by:
writeLongLE
in interfaceEndianDataOutput
- Throws:
java.io.IOException
-
-