|
||||||||||
| 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 DataInputStream |
dis
to get at the big-Endian methods of a basic DataInputStream |
protected InputStream |
is
to get at the a basic readBytes method. |
protected byte[] |
work
work array for buffering input. |
| Constructor Summary | |
|---|---|
LEDataInputStream(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. |
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. |
String |
readUTF()
Read UTF counted string. |
static String |
readUTF(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 DataInputStream dis
protected final InputStream is
protected final byte[] work
| Constructor Detail |
|---|
public LEDataInputStream(InputStream in)
in - binary inputstream of little-endian data.| Method Detail |
|---|
public static String readUTF(DataInput in)
throws IOException
in - stream to read UTF chars from (endian irrelevant)
IOException - if read fails.
public final void close()
throws IOException
IOException - if close fails.
public final int read(byte[] ba,
int off,
int len)
throws IOException
ba - where the bytes go.off - offset in buffer, not offset in file.len - count of bytes to read.
IOException - if read fails.
public final boolean readBoolean()
throws IOException
readBoolean in interface DataInputIOException - if read fails.DataInput.readBoolean()
public final byte readByte()
throws IOException
readByte in interface DataInputIOException - if read fails.DataInput.readByte()
public final char readChar()
throws IOException
readChar in interface DataInputIOException - if read fails.
public final double readDouble()
throws IOException
readDouble in interface DataInputIOException
public final float readFloat()
throws IOException
readFloat in interface DataInputIOException - if read fails.
public final void readFully(byte[] ba)
throws IOException
readFully in interface DataInputIOExceptionDataInput.readFully(byte[])
public final void readFully(byte[] ba,
int off,
int len)
throws IOException
readFully in interface DataInputIOException - if read fails.DataInput.readFully(byte[],int,int)
public final int readInt()
throws IOException
readInt in interface DataInputIOException - if read fails.
public final String readLine()
throws IOException
readLine in interface DataInputIOException
public final long readLong()
throws IOException
readLong in interface DataInputIOException
public final short readShort()
throws IOException
readShort in interface DataInputIOException - if read fails.
public final String readUTF()
throws IOException
readUTF in interface DataInputIOException
public final int readUnsignedByte()
throws IOException
readUnsignedByte in interface DataInputIOException - if read fails.DataInput.readUnsignedByte()
public final int readUnsignedShort()
throws IOException
readUnsignedShort in interface DataInputIOException - if read fails.
public final int skipBytes(int n)
throws IOException
skipBytes method of
DataInput.
Bytes for this operation are read from the contained input stream.
skipBytes in interface DataInputn - the number of bytes to be skipped.
IOException - if an I/O error occurs.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||