|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
java.io.FilterOutputStream
com.kirkwarez.kirkpack.io.EndianOutputStream
This stream behaves about exactly as DataOutputStream
, it writes
primitive and some non-primitive data types to the underlying stream. The reason it
doesn't extend DataOutputStream
is because all methods in that class are
declared final. This class does implement DataOutput
.
The big difference is that this class takes a byte order on construction, and guarantees that the primitives' bytes will be written out using that byte order.
The non-primitive methods from this class are delegated to a
DataOutputStream
.
Field Summary | |
static int |
BIG_ENDIAN
The Big Endian byte order. |
protected int |
byteorder
The byte order used by this stream. |
protected DataOutputStream |
cache
The OutputStream that FilterOutputStream parent class
delegates to, only uncast. |
static int |
LITTLE_ENDIAN
The Little Endian byte order. |
Fields inherited from class java.io.FilterOutputStream |
out |
Constructor Summary | |
EndianOutputStream(OutputStream output,
int byteorder)
Constucts a new stream that writes out primitives using the given byte order. |
Method Summary | |
int |
getByteorder()
Returns the byte order. |
protected void |
setByteorder(int byteorder)
Sets the byte order. |
void |
writeBoolean(boolean value)
See the general contract of DataOutput . |
void |
writeByte(byte value)
Writes a byte to the underlying stream. |
void |
writeByte(int value)
See the general contract of DataOutput . |
void |
writeBytes(String string)
See the general contract of DataOutput . |
void |
writeChar(char value)
Symmerty method for EndianInputStream . |
void |
writeChar(int value)
See the general contract of DataOutput . |
void |
writeChars(String string)
See the general contract of DataOutput . |
void |
writeDouble(double value)
See the general contract of DataOutput . |
void |
writeFloat(float value)
See the general contract of DataOutput . |
void |
writeInt(int value)
See the general contract of DataOutput . |
void |
writeLong(long value)
See the general contract of DataOutput . |
void |
writeShort(int value)
See the general contract of DataOutput . |
void |
writeShort(short value)
Writes a short to the underlying stream. |
void |
writeUnsignedByte(int value)
Writes an unsigned byte to the underlying stream. |
void |
writeUnsignedInt(long value)
Writes an unsigned int to the underlying stream. |
void |
writeUnsignedShort(int value)
Writes an unsigned short to the underlying stream. |
void |
writeUTF(String string)
See the general contract of DataOutput . |
Methods inherited from class java.io.FilterOutputStream |
close, flush, write, write, write |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.io.DataOutput |
write, write, write |
Field Detail |
protected DataOutputStream cache
OutputStream
that FilterOutputStream
parent class
delegates to, only uncast.
protected int byteorder
public static final int BIG_ENDIAN
public static final int LITTLE_ENDIAN
Constructor Detail |
public EndianOutputStream(OutputStream output, int byteorder)
output
- The stream to write to.byteorder
- The byte order. This is either BIG_ENDIAN or LITTLE_ENDIAN.Method Detail |
public void writeBoolean(boolean value) throws IOException
DataOutput
.
writeBoolean
in interface DataOutput
value
- The next boolean to be written to this stream.
IOException
- When IO errors happen.DataOutput.writeBoolean(boolean)
public void writeByte(int value) throws IOException
DataOutput
.
writeByte
in interface DataOutput
value
- The next byte to be written to this stream.
IOException
- When IO errors happen.DataOutput.writeByte(int)
public void writeByte(byte value) throws IOException
DataOutput
stuff,
but it provides symmetry with EndianInputStream
.
value
- The next real byte to be written to this stream.
IOException
- When IO errors happen.public void writeUnsignedByte(int value) throws IOException
DataOutput
stuff, but it provides symmetry with EndianInputStream
.
value
- The next unsigned byte to be written to this stream.
IOException
- When IO errors happen.public void writeShort(int value) throws IOException
DataOutput
.
writeShort
in interface DataOutput
value
- The next short to be written to this stream.
IOException
- When IO errors happen.DataOutput.writeShort(int)
public void writeShort(short value) throws IOException
DataOutput
stuff,
but it provides symmetry with EndianInputStream
.
value
- The next real short to be written to this stream.
IOException
- When IO errors happen.public void writeUnsignedShort(int value) throws IOException
DataOutput
stuff, but it provides symmetry with
EndianInputStream
.
value
- The next unsigned short to be written to this stream.
IOException
- When IO errors happen.public void writeChar(int value) throws IOException
DataOutput
. This doesn't use byte
ordering, cause no one writes out his Unicode like this :P
writeChar
in interface DataOutput
value
- The next char to be written to this stream.
IOException
- When IO errors happen.DataOutput.writeChar(int)
public void writeChar(char value) throws IOException
EndianInputStream
. This doesn't use byte
ordering, cause no one writes out his Unicode like this :P
value
- The next char to be written to this stream.
IOException
- When IO errors happen.public void writeInt(int value) throws IOException
DataOutput
.
writeInt
in interface DataOutput
value
- The next int to be written to this stream.
IOException
- When IO errors happen.DataOutput.writeInt(int)
public void writeUnsignedInt(long value) throws IOException
DataOutput
stuff, but it provides symmetry with EndianInputStream
.
value
- The next unsigned byte to be written to this stream.
IOException
- When IO errors happen.public void writeLong(long value) throws IOException
DataOutput
.
writeLong
in interface DataOutput
value
- The next long to be written to this stream.
IOException
- When IO errors happen.DataOutput.writeLong(long)
public void writeFloat(float value) throws IOException
DataOutput
.
writeFloat
in interface DataOutput
value
- The next float to be written to this stream.
IOException
- When IO errors happen.DataOutput.writeFloat(float)
public void writeDouble(double value) throws IOException
DataOutput
.
writeDouble
in interface DataOutput
value
- The next double to be written to this stream.
IOException
- When IO errors happen.DataOutput.writeDouble(double)
public void writeBytes(String string) throws IOException
DataOutput
.
writeBytes
in interface DataOutput
string
- The next string to be written to this stream.
IOException
- When IO errors happen.DataOutput.writeBytes(String)
public void writeChars(String string) throws IOException
DataOutput
.
writeChars
in interface DataOutput
string
- The next string to be written to this stream.
IOException
- When IO errors happen.DataOutput.writeChars(String)
public void writeUTF(String string) throws IOException
DataOutput
.
writeUTF
in interface DataOutput
string
- The next string to be written to this stream.
IOException
- When IO errors happen.DataOutput.writeUTF(String)
public int getByteorder()
protected void setByteorder(int byteorder)
byteorder
- The byte order used by this stream.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |