public class ReadBuffer
extends java.lang.Object
RandomAccessFile
into a buffer and decodes the data.Modifier and Type | Method and Description |
---|---|
byte |
readByte()
Returns one signed byte from the read buffer.
|
float |
readFloat()
Converts four bytes from the read buffer to a float.
|
boolean |
readFromFile(int length)
Reads the given amount of bytes from the file into the read buffer and resets the internal buffer position.
|
boolean |
readFromFile(long offset,
int length)
Reads the given amount of bytes from the file into the read buffer and resets the internal buffer position.
|
int |
readInt()
Converts four bytes from the read buffer to a signed int.
|
long |
readLong()
Converts eight bytes from the read buffer to a signed long.
|
int |
readShort()
Converts two bytes from the read buffer to a signed int.
|
int |
readSignedInt()
Converts a variable amount of bytes from the read buffer to a signed int.
|
int |
readUnsignedInt()
Converts a variable amount of bytes from the read buffer to an unsigned int.
|
java.lang.String |
readUTF8EncodedString()
Decodes a variable amount of bytes from the read buffer to a string.
|
java.lang.String |
readUTF8EncodedString(int stringLength)
Decodes the given amount of bytes from the read buffer to a string.
|
public byte readByte()
public float readFloat()
public boolean readFromFile(int length) throws java.io.IOException
length
- the amount of bytes to read from the file.java.io.IOException
- if an error occurs while reading the file.public boolean readFromFile(long offset, int length) throws java.io.IOException
offset
- the offset position, measured in bytes from the beginning of the file, at which to set the file pointer.length
- the amount of bytes to read from the file.java.io.IOException
- if an error occurs while reading the file.public int readInt()
public long readLong()
public int readShort()
public int readSignedInt()
public int readUnsignedInt()
public java.lang.String readUTF8EncodedString()
public java.lang.String readUTF8EncodedString(int stringLength)
stringLength
- the length of the string in bytes.