public class BufferedRandomInput extends Object implements BasicInput
| Modifier and Type | Field and Description |
|---|---|
static int |
DFLT_BUFSIZE |
| Constructor and Description |
|---|
BufferedRandomInput(RandomAccessFile file,
long offset0)
Constructs a BufferedRandomInput with a default sized buffer.
|
BufferedRandomInput(RandomAccessFile file,
long offset0,
int bufsize)
Constructs a BufferedRandomInput with a buffer of specified size.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Releases resources belonging to this object.
|
long |
getOffset()
Returns the curent position in this stream
(optional operation).
|
boolean |
isRandom()
Indicates whether this object supports random access.
|
byte |
readByte()
Reads a byte from the stream.
|
void |
readBytes(byte[] bbuf)
Reads bytes into an array from the stream.
|
double |
readDouble()
Reads an 8-byte floating point value from the stream.
|
float |
readFloat()
Reads a 4-byte floating point value from the stream.
|
int |
readInt()
Reads a 4-byte integer from the stream.
|
long |
readLong()
Reads an 8-byte integer from the stream.
|
short |
readShort()
Reads a 2-byte integer from the stream.
|
void |
seek(long offset)
Moves the current position of this stream to a given byte offset
(optional operation).
|
void |
skip(long nbytes)
Skips a given number of bytes forwards through the stream.
|
public BufferedRandomInput(RandomAccessFile file, long offset0) throws IOException
file - fileoffset0 - offset into file of stream startIOExceptionpublic BufferedRandomInput(RandomAccessFile file, long offset0, int bufsize) throws IOException
file - fileoffset0 - offset into file of stream startbufsize - buffer sizeIOExceptionpublic byte readByte()
throws IOException
BasicInputreadByte in interface BasicInputIOExceptionpublic short readShort()
throws IOException
BasicInputreadShort in interface BasicInputIOExceptionpublic int readInt()
throws IOException
BasicInputreadInt in interface BasicInputIOExceptionpublic long readLong()
throws IOException
BasicInputreadLong in interface BasicInputIOExceptionpublic float readFloat()
throws IOException
BasicInputreadFloat in interface BasicInputIOExceptionpublic double readDouble()
throws IOException
BasicInputreadDouble in interface BasicInputIOExceptionpublic void readBytes(byte[] bbuf)
throws IOException
BasicInputreadBytes in interface BasicInputbbuf - array into which the bytes are read;
the number of bytes read is the length of the arrayIOExceptionpublic boolean isRandom()
BasicInputisRandom in interface BasicInputpublic void skip(long nbytes)
throws IOException
BasicInputskip in interface BasicInputnbytes - number of bytes to skipIOExceptionpublic long getOffset()
BasicInputgetOffset in interface BasicInputpublic void seek(long offset)
throws IOException
BasicInputseek in interface BasicInputIOExceptionpublic void close()
throws IOException
BasicInputclose in interface BasicInputIOExceptionCopyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.