|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface RandomAccessInput
This interface extends DataInput by adding methods for random access to the contents. The method names and signatures were pulled up from RandomAccessFile. This interface will generally be useful for classes providing random input access to a file or file-like structure, i.e. file readers or parsers.
DataInput
,
RandomAccessFile
Method Summary | |
---|---|
String |
getDescription()
Provides some kind of description of this item, useful in user messages. |
InputStream |
getInputStream()
Return the input as an InputStream. |
long |
getOffset()
Returns the current offset in this input. |
long |
length()
Returns the length of this input. |
BigDecimal |
readFixed16x16Signed()
Reads a fixed-length decimal number with a 16-bit signed twos-complement mantissa, followed by a 16-bit unsigned fraction. |
String |
readNullTerminatedString(Charset characterSet)
Reads a null-terminated String. |
int |
readShortLoHi()
Read a signed 2-byte short in little-endian order, that is, making the first byte the low-order byte and the second byte the high-order byte. |
String |
readString(int stringSize,
Charset characterSet)
Reads a String of stringSize bytes at the current location. |
String |
readStringASCII(int stringSize)
Reads an ASCII String of stringSize bytes at the current location. |
String |
readTerminatedString(byte terminatingChar,
Charset characterSet)
Reads a string terminated by a specific character, usually the null character, 0x00. |
long |
readUnsignedInt()
Read 4 unsigned bytes and convert them to a long containing the unsigned value. |
long |
readUnsignedIntLoHi()
Read an unsigned 4-byte integer, and reverse the byte order, making the lowest-order byte first and the highest-order byte last. |
int |
readUnsignedShortLoHi()
Read an unsigned 2-byte short, and reverse the byte order, making the low-order byte first and the high-order byte last. |
void |
seek(long offset)
Sets the input pointer offset, measured from the beginning of the input, at which the next read occurs. |
Methods inherited from interface java.io.DataInput |
---|
readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, skipBytes |
Method Detail |
---|
void seek(long offset) throws IOException
Sets the input pointer offset, measured from the beginning of the input, at which the next read occurs. The offset may be set beyond the end of the input. Setting the offset beyond the end of the input does not change the input length.
This method is based on RandomAccessFile.seek(long)
.
offset
- The offset position, measured in bytes from the beginning of
the input, at which to set the input pointer.
IOException
- If pos
is less than 0
, or if an I/O error occurs.RandomAccessFile.seek(long)
long getOffset() throws IOException
Returns the current offset in this input.
This method is based on RandomAccessFile.getFilePointer()
.
IOException
- If an I/O error occurs.RandomAccessFile.getFilePointer()
long length() throws IOException
Returns the length of this input.
This method is based on RandomAccessFile.length()
.
IOException
- If an I/O error occurs.RandomAccessFile.length()
String getDescription()
InputStream getInputStream() throws IOException
IOException
- If an I/O error occurs.String readString(int stringSize, Charset characterSet) throws IOException
stringSize
- The length, in bytes, of the String to be read.characterSet
- The encoding scheme to be used for interpreting the characters in the string.
IOException
- For reading past the end of the input.String readStringASCII(int stringSize) throws IOException
stringSize
- The length, in bytes, of the String to be read.
IOException
- For reading past the end of the input.String readTerminatedString(byte terminatingChar, Charset characterSet) throws IOException
terminatingChar
- The value to be used as the terminator for the read String.characterSet
- The encoding scheme to be used for interpreting the characters in the string.
IOException
- For I/O error.String readNullTerminatedString(Charset characterSet) throws IOException
characterSet
- The encoding scheme to be used for interpreting the characters in the string.
IOException
- For I/O error.long readUnsignedInt() throws IOException
IOException
- For I/O error.long readUnsignedIntLoHi() throws IOException
IOException
- For I/O error.int readUnsignedShortLoHi() throws IOException
IOException
- For I/O error.int readShortLoHi() throws IOException
IOException
- For I/O error.BigDecimal readFixed16x16Signed() throws IOException
IOException
- For I/O Error.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |