public interface RandomAccessIO extends BinaryDataInput, BinaryDataOutput
This interface supports streams of up to 2 GB in length.
BinaryDataInput
,
BinaryDataOutput
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the I/O stream.
|
int |
getPos()
Returns the current position in the stream, which is the position from
where the next byte of data would be read.
|
int |
length()
Returns the current length of the stream, in bytes, taking into account
any buffering.
|
int |
read()
Reads a byte of data from the stream.
|
void |
readFully(byte[] b,
int off,
int len)
Reads up to len bytes of data from this file into an array of
bytes.
|
void |
seek(int off)
Moves the current position for the next read or write operation to
offset.
|
void |
write(int b)
Writes a byte to the stream.
|
getByteOrdering, readByte, readDouble, readFloat, readInt, readLong, readShort, readUnsignedByte, readUnsignedInt, readUnsignedShort, skipBytes
flush, getByteOrdering, writeByte, writeDouble, writeFloat, writeInt, writeLong, writeShort
void close() throws IOException
IOException
- If an I/O error ocurred.int getPos() throws IOException
IOException
- If an I/O error ocurred.int length() throws IOException
IOException
- If an I/O error ocurred.void seek(int off) throws IOException
off
- The offset where to move to.EOFException
- If in read-only and seeking beyond EOF.IOException
- If an I/O error ocurred.int read() throws EOFException, IOException
EOFException
- If the end-of file was reached.IOException
- If an I/O error ocurred.void readFully(byte[] b, int off, int len) throws IOException
b
- The buffer into which the data is to be read. It must be long
enough.off
- The index in 'b' where to place the first byte read.len
- The number of bytes to read.EOFException
- If the end-of file was reached before
getting all the necessary data.IOException
- If an I/O error ocurred.void write(int b) throws IOException
b
- The byte to write. The lower 8 bits of b are
written.IOException
- If an I/O error ocurred.Copyright © 2014. All rights reserved.