public class BufferedRandomInput extends java.lang.Object implements BasicInput
| Modifier and Type | Field and Description |
|---|---|
static int |
DFLT_BUFSIZE |
| Constructor and Description |
|---|
BufferedRandomInput(java.io.RandomAccessFile file,
long offset0)
Constructs a BufferedRandomInput with a default sized buffer.
|
BufferedRandomInput(java.io.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(java.io.RandomAccessFile file,
long offset0)
throws java.io.IOException
file - fileoffset0 - offset into file of stream startjava.io.IOExceptionpublic BufferedRandomInput(java.io.RandomAccessFile file,
long offset0,
int bufsize)
throws java.io.IOException
file - fileoffset0 - offset into file of stream startbufsize - buffer sizejava.io.IOExceptionpublic byte readByte()
throws java.io.IOException
BasicInputreadByte in interface BasicInputjava.io.IOExceptionpublic short readShort()
throws java.io.IOException
BasicInputreadShort in interface BasicInputjava.io.IOExceptionpublic int readInt()
throws java.io.IOException
BasicInputreadInt in interface BasicInputjava.io.IOExceptionpublic long readLong()
throws java.io.IOException
BasicInputreadLong in interface BasicInputjava.io.IOExceptionpublic float readFloat()
throws java.io.IOException
BasicInputreadFloat in interface BasicInputjava.io.IOExceptionpublic double readDouble()
throws java.io.IOException
BasicInputreadDouble in interface BasicInputjava.io.IOExceptionpublic void readBytes(byte[] bbuf)
throws java.io.IOException
BasicInputreadBytes in interface BasicInputbbuf - array into which the bytes are read;
the number of bytes read is the length of the arrayjava.io.IOExceptionpublic boolean isRandom()
BasicInputisRandom in interface BasicInputpublic void skip(long nbytes)
throws java.io.IOException
BasicInputskip in interface BasicInputnbytes - number of bytes to skipjava.io.IOExceptionpublic long getOffset()
BasicInputgetOffset in interface BasicInputpublic void seek(long offset)
throws java.io.IOException
BasicInputseek in interface BasicInputjava.io.IOExceptionpublic void close()
throws java.io.IOException
BasicInputclose in interface BasicInputjava.io.IOException