public class SimpleMappedInput extends java.lang.Object implements BasicInput
Note: DO NOT use an instance
of this class from multiple threads - see Unmapper.
| Constructor and Description |
|---|
SimpleMappedInput(java.nio.channels.FileChannel chan,
long pos,
int size,
java.lang.String logName)
Constructor.
|
| 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 pos)
Moves the current position of this stream to a given byte offset
(optional operation).
|
void |
skip(long nbyte)
Skips a given number of bytes forwards through the stream.
|
public SimpleMappedInput(java.nio.channels.FileChannel chan,
long pos,
int size,
java.lang.String logName)
throws java.io.IOException
chan - file channel, preferably read-onlypos - offset into file of stream startsize - number of bytes in streamlogName - name for mapped region used in logging messagesjava.io.IOExceptionpublic boolean isRandom()
BasicInputisRandom in interface BasicInputpublic void seek(long pos)
throws java.io.EOFException
BasicInputseek in interface BasicInputjava.io.EOFExceptionpublic long getOffset()
BasicInputgetOffset in interface BasicInputpublic void skip(long nbyte)
throws java.io.IOException
BasicInputskip in interface BasicInputnbyte - number of bytes to skipjava.io.IOExceptionpublic byte readByte()
throws java.io.EOFException
BasicInputreadByte in interface BasicInputjava.io.EOFExceptionpublic short readShort()
throws java.io.EOFException
BasicInputreadShort in interface BasicInputjava.io.EOFExceptionpublic int readInt()
throws java.io.EOFException
BasicInputreadInt in interface BasicInputjava.io.EOFExceptionpublic long readLong()
throws java.io.EOFException
BasicInputreadLong in interface BasicInputjava.io.EOFExceptionpublic float readFloat()
throws java.io.EOFException
BasicInputreadFloat in interface BasicInputjava.io.EOFExceptionpublic double readDouble()
throws java.io.EOFException
BasicInputreadDouble in interface BasicInputjava.io.EOFExceptionpublic void readBytes(byte[] bbuf)
throws java.io.EOFException
BasicInputreadBytes in interface BasicInputbbuf - array into which the bytes are read;
the number of bytes read is the length of the arrayjava.io.EOFExceptionpublic void close()
BasicInputclose in interface BasicInput