public class LEFilterOutputStream
extends java.io.FilterOutputStream
implements java.io.DataOutput
com.macfaq.io.LittleEndianInputStream
,
DataOutputStream
Constructor and Description |
---|
LEFilterOutputStream(java.io.OutputStream out)
Creates a new little endian output stream and chains it to the
output stream specified by the out argument.
|
Modifier and Type | Method and Description |
---|---|
int |
size()
Returns the number of bytes written to this little endian output stream.
|
void |
write(byte[] data,
int offset,
int length)
Writes
length bytes from the specified byte array
starting at offset to the underlying output stream. |
void |
write(int b)
Writes the specified byte value to the underlying output stream.
|
void |
writeBoolean(boolean b)
Writes a
boolean to the underlying output stream as
a single byte. |
void |
writeByte(int b)
Writes out a
byte to the underlying output stream |
void |
writeBytes(java.lang.String s)
Writes a string to the underlying output stream as a sequence of
bytes.
|
void |
writeChar(int c)
Writes a two byte
char to the underlying output stream
in little endian order, low byte first. |
void |
writeChars(java.lang.String s)
Writes a string to the underlying output stream as a sequence of
characters.
|
void |
writeDouble(double d)
Writes an 8 byte Java double to the underlying output stream in
little endian order.
|
void |
writeFloat(float f)
Writes a 4 byte Java float to the underlying output stream in
little endian order.
|
void |
writeInt(int i)
Writes a four-byte
int to the underlying output stream
in little endian order, low byte first, high byte last |
void |
writeLong(long l)
Writes an eight-byte
long to the underlying output stream
in little endian order, low byte first, high byte last |
void |
writeShort(int s)
Writes a two byte
short to the underlying output stream in
little endian order, low byte first. |
void |
writeUTF(java.lang.String s)
Writes a string of no more than 65,535 characters
to the underlying output stream using UTF-8
encoding.
|
public LEFilterOutputStream(java.io.OutputStream out)
out
- the underlying output stream.FilterOutputStream.out
public void write(int b) throws java.io.IOException
write
in interface java.io.DataOutput
write
in class java.io.FilterOutputStream
b
- the byte
value to be written.java.io.IOException
- if the underlying stream throws an IOException.public void write(byte[] data, int offset, int length) throws java.io.IOException
length
bytes from the specified byte array
starting at offset
to the underlying output stream.write
in interface java.io.DataOutput
write
in class java.io.FilterOutputStream
data
- the data.offset
- the start offset in the data.length
- the number of bytes to write.java.io.IOException
- if the underlying stream throws an IOException.public void writeBoolean(boolean b) throws java.io.IOException
boolean
to the underlying output stream as
a single byte. If the argument is true, the byte value 1 is written.
If the argument is false, the byte value 0
in written.writeBoolean
in interface java.io.DataOutput
b
- the boolean
value to be written.java.io.IOException
- if the underlying stream throws an IOException.public void writeByte(int b) throws java.io.IOException
byte
to the underlying output streamwriteByte
in interface java.io.DataOutput
b
- the byte
value to be written.java.io.IOException
- if the underlying stream throws an IOException.public void writeShort(int s) throws java.io.IOException
short
to the underlying output stream in
little endian order, low byte first.writeShort
in interface java.io.DataOutput
s
- the short
to be written.java.io.IOException
- if the underlying stream throws an IOException.public void writeChar(int c) throws java.io.IOException
char
to the underlying output stream
in little endian order, low byte first.writeChar
in interface java.io.DataOutput
c
- the char
value to be written.java.io.IOException
- if the underlying stream throws an IOException.public void writeInt(int i) throws java.io.IOException
int
to the underlying output stream
in little endian order, low byte first, high byte lastwriteInt
in interface java.io.DataOutput
i
- the int
to be written.java.io.IOException
- if the underlying stream throws an IOException.public void writeLong(long l) throws java.io.IOException
long
to the underlying output stream
in little endian order, low byte first, high byte lastwriteLong
in interface java.io.DataOutput
l
- the long
to be written.java.io.IOException
- if the underlying stream throws an IOException.public final void writeFloat(float f) throws java.io.IOException
writeFloat
in interface java.io.DataOutput
f
- the float
value to be written.java.io.IOException
- if an I/O error occurs.public final void writeDouble(double d) throws java.io.IOException
writeDouble
in interface java.io.DataOutput
d
- the double
value to be written.java.io.IOException
- if an I/O error occurs.public void writeBytes(java.lang.String s) throws java.io.IOException
writeByte()
method.writeBytes
in interface java.io.DataOutput
s
- the String
value to be written.java.io.IOException
- if the underlying stream throws an IOException.java.io.LittleEndianOutputStream#writeByte(int)
,
java.io.LittleEndianOutputStream#out
public void writeChars(java.lang.String s) throws java.io.IOException
writeChar
method.writeChars
in interface java.io.DataOutput
s
- a String
value to be written.java.io.IOException
- if the underlying stream throws an IOException.java.io.LittleEndianOutputStream#writeChar(int)
,
java.io.LittleEndianOutputStream#out
public void writeUTF(java.lang.String s) throws java.io.IOException
writeUTF
in interface java.io.DataOutput
s
- the string to be written.java.io.UTFDataFormatException
- if the string is longer than
65,535 characters.java.io.IOException
- if the underlying stream throws an IOException.public int size()
written
field.java.io.LittleEndianOutputStream#written