|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--com.jfimagine.utils.io.JFBinaryReader
JFBinaryReader is a binary reader class to handle JFDraw files reading.
| Constructor Summary | |
JFBinaryReader(java.io.DataInputStream dataInput)
Constructor of JFBinaryReader |
|
| Method Summary | |
int |
read(byte[] b,
int off,
int len)
Reads up to len bytes of data from the contained
input stream into an array of bytes. |
boolean |
readBoolean()
Reads one input byte and returns true if that byte is nonzero,
false if that byte is zero.
|
byte |
readByte()
Reads and returns one input byte. |
char |
readChar()
Reads an input char and returns the char value.
|
double |
readDouble()
Reads eight input bytes and returns a double value.
|
float |
readFloat()
Reads four input bytes and returns a float value.
|
int |
readInt()
Reads four input bytes and returns an int value.
|
long |
readLong()
Reads eight input bytes and returns a long value.
|
short |
readShort()
Reads two input bytes and returns a short value.
|
int |
readUnsignedByte()
Reads one input byte, zero-extends it to type int, and returns
the result, which is therefore in the range
0
through 255.
|
int |
readUnsignedShort()
Reads two input bytes and returns an int value in the range 0
through 65535.
|
java.lang.String |
readUTF()
Reads in a string that has been encoded using a modified UTF-8 format. |
int |
skipBytes(int n)
Makes an attempt to skip over n bytes
of data from the input
stream, discarding the skipped bytes.
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public JFBinaryReader(java.io.DataInputStream dataInput)
| Method Detail |
public int read(byte[] b,
int off,
int len)
throws java.io.IOException
len bytes of data from the contained
input stream into an array of bytes. An attempt is made to read
as many as len bytes, but a smaller number may be read,
possibly zero. The number of bytes actually read is returned as an
integer.
read in interface JFReaderb - the buffer into which the data is read.off - the start offset of the data.len - the maximum number of bytes read.
-1 if there is no more data because the end
of the stream has been reached.
java.io.IOException - if an I/O error occurs.
public int skipBytes(int n)
throws java.io.IOException
n bytes
of data from the input
stream, discarding the skipped bytes.
The actual
number of bytes skipped is returned.
skipBytes in interface JFReadern - the number of bytes to be skipped.
java.io.IOException - if an I/O error occurs.
public boolean readBoolean()
throws java.io.IOException
true if that byte is nonzero,
false if that byte is zero.
This method is suitable for reading
the byte written by the writeBoolean
method in JFWriter.
readBoolean in interface JFReaderboolean value read.
EOFException - if this stream reaches the end before reading
all the bytes.
java.io.IOException - if an I/O error occurs.
public byte readByte()
throws java.io.IOException
writeByte
method in JFWriter.
readByte in interface JFReaderEOFException - if this stream reaches the end before reading
all the bytes.
java.io.IOException - if an I/O error occurs.
public int readUnsignedByte()
throws java.io.IOException
int, and returns
the result, which is therefore in the range
0
through 255.
This method is suitable for reading
the byte written by the writeByte
method in JFWriter.
readUnsignedByte in interface JFReaderEOFException - if this stream reaches the end before reading
all the bytes.
java.io.IOException - if an I/O error occurs.
public short readShort()
throws java.io.IOException
short value.
This method
is suitable for reading the bytes written
by the writeShort method in JFWriter.
readShort in interface JFReaderEOFException - if this stream reaches the end before reading
all the bytes.
java.io.IOException - if an I/O error occurs.
public int readUnsignedShort()
throws java.io.IOException
int value in the range 0
through 65535.
This method is suitable for reading the bytes
written by the writeShort method in JFWriter.
readUnsignedShort in interface JFReaderEOFException - if this stream reaches the end before reading
all the bytes.
java.io.IOException - if an I/O error occurs.
public char readChar()
throws java.io.IOException
char and returns the char value.
This method
is suitable for reading bytes written by
the writeChar method in JFWriter.
readChar in interface JFReaderchar read.
EOFException - if this stream reaches the end before reading
all the bytes.
java.io.IOException - if an I/O error occurs.
public int readInt()
throws java.io.IOException
int value.
This method is suitable
for reading bytes written by the writeInt
method in JFWriter.
readInt in interface JFReaderint value read.
EOFException - if this stream reaches the end before reading
all the bytes.
java.io.IOException - if an I/O error occurs.
public long readLong()
throws java.io.IOException
long value.
This method is suitable
for reading bytes written by the writeLong
method in JFWriter.
readLong in interface JFReaderlong value read.
EOFException - if this stream reaches the end before reading
all the bytes.
java.io.IOException - if an I/O error occurs.
public float readFloat()
throws java.io.IOException
float value.
This method is suitable for reading
bytes written by the writeFloat
method in JFWriter.
readFloat in interface JFReaderfloat value read.
EOFException - if this stream reaches the end before reading
all the bytes.
java.io.IOException - if an I/O error occurs.
public double readDouble()
throws java.io.IOException
double value.
This method is suitable for reading
bytes written by the writeDouble
method in JFWriter.
readDouble in interface JFReaderdouble value read.
EOFException - if this stream reaches the end before reading
all the bytes.
java.io.IOException - if an I/O error occurs.
public java.lang.String readUTF()
throws java.io.IOException
The writeUTF
method in JFWriter may be used to write data that is suitable
for reading by this method.
readUTF in interface JFReaderEOFException - if this stream reaches the end
before reading all the bytes.
java.io.IOException - if an I/O error occurs.
UTFDataFormatException - if the bytes do not represent a
valid UTF-8 encoding of a string.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||