|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mindprod.ledatastream.LEDataInputStream
public final class LEDataInputStream
Little-Endian version of DataInputStream.
Very similar to DataInputStream except it reads little-endian instead of big-endian binary data. We can't extend DataInputStream directly since it has only final methods, though DataInputStream itself is not final. This forces us implement LEDataInputStream with a DataInputStream object, and use wrapper methods.
Field Summary | |
---|---|
protected java.io.DataInputStream |
dis
to get at the big-Endian methods of a basic DataInputStream |
protected java.io.InputStream |
is
to get at the a basic readBytes method. |
protected byte[] |
work
work array for buffering input. |
Constructor Summary | |
---|---|
LEDataInputStream(java.io.InputStream in)
constructor. |
Method Summary | |
---|---|
void |
close()
close. |
int |
read(byte[] ba,
int off,
int len)
Read bytes. |
boolean |
readBoolean()
read only a one-byte boolean. |
byte |
readByte()
read byte. |
char |
readChar()
Read on char. |
double |
readDouble()
Read a double. |
float |
readFloat()
Read one float. |
void |
readFully(byte[] ba)
Read bytes until the array is filled. |
void |
readFully(byte[] ba,
int off,
int len)
Read bytes until the count is satisfied. |
int |
readInt()
Read an int, 32-bits. |
java.lang.String |
readLine()
Deprecated. This method does not properly convert bytes to characters. Use a Reader instead with a little-endian encoding. |
long |
readLong()
read a long, 64-bits. |
short |
readShort()
Read short, 16-bits. |
int |
readUnsignedByte()
Read an unsigned byte. |
int |
readUnsignedShort()
Read an unsigned short, 16 bits. |
java.lang.String |
readUTF()
Read UTF counted string. |
static java.lang.String |
readUTF(java.io.DataInput in)
Note. |
int |
skipBytes(int n)
Skip over bytes in the stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final java.io.DataInputStream dis
protected final java.io.InputStream is
protected final byte[] work
Constructor Detail |
---|
public LEDataInputStream(java.io.InputStream in)
in
- binary inputstream of little-endian data.Method Detail |
---|
public static java.lang.String readUTF(java.io.DataInput in) throws java.io.IOException
in
- stream to read UTF chars from (endian irrelevant)
java.io.IOException
- if read fails.public final void close() throws java.io.IOException
java.io.IOException
- if close fails.public final int read(byte[] ba, int off, int len) throws java.io.IOException
ba
- where the bytes go.off
- offset in buffer, not offset in file.len
- count of bytes to read.
java.io.IOException
- if read fails.public final boolean readBoolean() throws java.io.IOException
readBoolean
in interface java.io.DataInput
java.io.IOException
- if read fails.DataInput.readBoolean()
public final byte readByte() throws java.io.IOException
readByte
in interface java.io.DataInput
java.io.IOException
- if read fails.DataInput.readByte()
public final char readChar() throws java.io.IOException
readChar
in interface java.io.DataInput
java.io.IOException
- if read fails.public final double readDouble() throws java.io.IOException
readDouble
in interface java.io.DataInput
java.io.IOException
public final float readFloat() throws java.io.IOException
readFloat
in interface java.io.DataInput
java.io.IOException
- if read fails.public final void readFully(byte[] ba) throws java.io.IOException
readFully
in interface java.io.DataInput
java.io.IOException
DataInput.readFully(byte[])
public final void readFully(byte[] ba, int off, int len) throws java.io.IOException
readFully
in interface java.io.DataInput
java.io.IOException
- if read fails.DataInput.readFully(byte[],int,int)
public final int readInt() throws java.io.IOException
readInt
in interface java.io.DataInput
java.io.IOException
- if read fails.public final java.lang.String readLine() throws java.io.IOException
readLine
in interface java.io.DataInput
java.io.IOException
public final long readLong() throws java.io.IOException
readLong
in interface java.io.DataInput
java.io.IOException
public final short readShort() throws java.io.IOException
readShort
in interface java.io.DataInput
java.io.IOException
- if read fails.public final java.lang.String readUTF() throws java.io.IOException
readUTF
in interface java.io.DataInput
java.io.IOException
public final int readUnsignedByte() throws java.io.IOException
readUnsignedByte
in interface java.io.DataInput
java.io.IOException
- if read fails.DataInput.readUnsignedByte()
public final int readUnsignedShort() throws java.io.IOException
readUnsignedShort
in interface java.io.DataInput
java.io.IOException
- if read fails.public final int skipBytes(int n) throws java.io.IOException
skipBytes
method of
DataInput
.
Bytes for this operation are read from the contained input stream.
skipBytes
in interface java.io.DataInput
n
- the number of bytes to be skipped.
java.io.IOException
- if an I/O error occurs.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |