|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.io.OutputStream
java.io.FilterOutputStream
de.schlichtherle.io.util.LEDataOutputStream
public class LEDataOutputStream
A stream to write data in Little Endian (LE) format.
This class is similar to DataOutputStream,
but writes data in Little Endian format to its underlying stream.
A noteable difference to DataOutputStream is that the
size() method and the written field are respectively
return long values and wrap to Long.MAX_VALUE.
Note that this class is not thread safe.
| Field Summary | |
|---|---|
protected long |
written
The number of bytes written to the data output stream so far. |
| Fields inherited from class java.io.FilterOutputStream |
|---|
out |
| Constructor Summary | |
|---|---|
LEDataOutputStream(OutputStream out)
Creates a new data output stream to write data to the specified underlying output stream. |
|
| Method Summary | |
|---|---|
long |
size()
Returns the current value of the counter written,
the number of bytes written to this data output stream so far. |
void |
write(byte[] b,
int off,
int len)
Writes len bytes from the specified byte array
starting at offset off to the underlying output stream. |
void |
write(int b)
Writes the specified byte (the low eight bits of the argument b) to the underlying output stream. |
void |
writeBoolean(boolean b)
Writes a boolean value to the underlying output stream
as a 1-byte value. |
void |
writeByte(int b)
Writes a byte value to the underlying output stream
as a 1-byte value. |
void |
writeBytes(String s)
Writes the string s to the underlying output stream as a
sequence of bytes. |
void |
writeChar(int c)
Writes a char value to the underlying output stream
as a 2-byte value, low byte first. |
void |
writeChars(String s)
Writes the string s to the underlying output stream as a
sequence of characters. |
void |
writeDouble(double d)
Converts the double value d to a long using
the doubleToLongBits method in class Double,
and then writes that long value to the underlying
output stream as an 8-byte quantity, low byte first. |
void |
writeFloat(float f)
Converts the float value f to an int using
the floatToIntBits method in class Float,
and then writes that int value to the underlying
output stream as a 4-byte quantity, low byte first. |
void |
writeInt(int i)
Writes the integer value i to the underlying output stream
as four bytes, low byte first. |
void |
writeLong(long l)
Writes the integer value l to the underlying output stream
as eight bytes, low byte first. |
void |
writeShort(int s)
Writes the integer value s to the underlying output stream
as two bytes, low byte first. |
void |
writeUTF(String str)
This method is not implemented. |
| Methods inherited from class java.io.FilterOutputStream |
|---|
close, flush, 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 |
| Field Detail |
|---|
protected volatile long written
| Constructor Detail |
|---|
public LEDataOutputStream(OutputStream out)
written is
set to zero.
out - The underlying output stream, to be saved for later use.| Method Detail |
|---|
public void write(int b)
throws IOException
b) to the underlying output stream.
If no exception is thrown, the counter written is
incremented by one.
Implements the write method of OutputStream.
write in interface DataOutputwrite in class FilterOutputStreamb - The byte value to be written.
IOException - If an I/O error occurs.
public void write(byte[] b,
int off,
int len)
throws IOException
len bytes from the specified byte array
starting at offset off to the underlying output stream.
If no exception is thrown, the counter written is
incremented by len.
write in interface DataOutputwrite in class FilterOutputStreamb - The data.off - The start offset in the data.len - The number of bytes to write.
IOException - If an I/O error occurs.
public final void writeBoolean(boolean b)
throws IOException
boolean value to the underlying output stream
as a 1-byte value. The value true is written out as the
value (byte)1; the value false is
written out as the value (byte)0.
If no exception is thrown, the counter written is
incremented by one.
writeBoolean in interface DataOutputb - The boolean value to be written.
IOException - If an I/O error occurs.
public final void writeByte(int b)
throws IOException
byte value to the underlying output stream
as a 1-byte value.
If no exception is thrown, the counter written is
incremented by one.
writeByte in interface DataOutputb - The byte value to be written.
IOException - If an I/O error occurs.
public final void writeChar(int c)
throws IOException
char value to the underlying output stream
as a 2-byte value, low byte first.
If no exception is thrown, the counter written is
incremented by two.
writeChar in interface DataOutputc - The char value to be written.
IOException - If an I/O error occurs.
public final void writeShort(int s)
throws IOException
s to the underlying output stream
as two bytes, low byte first.
If no exception is thrown, the counter written is
incremented by two.
writeShort in interface DataOutputs - The short integer value to be written.
IOException - If an I/O error occurs.
public final void writeInt(int i)
throws IOException
i to the underlying output stream
as four bytes, low byte first.
If no exception is thrown, the counter written is
incremented by four.
writeInt in interface DataOutputi - The integer value to be written.
IOException - If an I/O error occurs.
public final void writeLong(long l)
throws IOException
l to the underlying output stream
as eight bytes, low byte first.
If no exception is thrown, the counter written is
incremented by eight.
writeLong in interface DataOutputl - The long integer value to be written.
IOException - If an I/O error occurs.
public final void writeFloat(float f)
throws IOException
f to an int using
the floatToIntBits method in class Float,
and then writes that int value to the underlying
output stream as a 4-byte quantity, low byte first.
If no exception is thrown, the counter written is
incremented by 4.
writeFloat in interface DataOutputf - The float value to be written.
IOException - If an I/O error occurs.Float.floatToIntBits(float)
public final void writeDouble(double d)
throws IOException
d to a long using
the doubleToLongBits method in class Double,
and then writes that long value to the underlying
output stream as an 8-byte quantity, low byte first.
If no exception is thrown, the counter written is
incremented by 8.
writeDouble in interface DataOutputd - The double value to be written.
IOException - If an I/O error occurs.Double.doubleToLongBits(double)
public final void writeBytes(String s)
throws IOException
s to the underlying output stream as a
sequence of bytes. Each character in the string is written out, in
sequence, by discarding its high eight bits.
If no exception is thrown, the counter written is
incremented by the length of s.
writeBytes in interface DataOutputs - The string of bytes to be written.
IOException - If an I/O error occurs.
public final void writeChars(String s)
throws IOException
s to the underlying output stream as a
sequence of characters. Each character is written out as
if by the writeChar method.
If no exception is thrown, the counter written is
incremented by twice the length of s.
writeChars in interface DataOutputs - The String value to be written.
IOException - If an I/O error occurs.DataOutputStream.writeChar(int)
public void writeUTF(String str)
throws IOException
writeUTF in interface DataOutputUnsupportedOperationException - Always.
IOExceptionpublic final long size()
written,
the number of bytes written to this data output stream so far.
If the counter overflows, it will be wrapped to Long.MAX_VALUE.
written field.DataOutputStream.written
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||