|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectuk.ac.starlink.fits.SimpleMappedInput
public class SimpleMappedInput
Random-access BasicInput implementation that maps a given region of a file as a monolithic byte buffer. On close, an attempt is made to unmap the buffer.
Note: DO NOT use an instance
of this class from multiple threads - see Unmapper.
| Constructor Summary | |
|---|---|
SimpleMappedInput(FileChannel chan,
long pos,
int size,
String logName)
Constructor. |
|
| Method Summary | |
|---|---|
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. |
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SimpleMappedInput(FileChannel chan,
long pos,
int size,
String logName)
throws 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 messages
IOException| Method Detail |
|---|
public boolean isRandom()
BasicInput
isRandom in interface BasicInput
public void seek(long pos)
throws EOFException
BasicInput
seek in interface BasicInputEOFExceptionpublic long getOffset()
BasicInput
getOffset in interface BasicInput
public void skip(long nbyte)
throws IOException
BasicInput
skip in interface BasicInputnbyte - number of bytes to skip
IOException
public byte readByte()
throws EOFException
BasicInput
readByte in interface BasicInputEOFException
public short readShort()
throws EOFException
BasicInput
readShort in interface BasicInputEOFException
public int readInt()
throws EOFException
BasicInput
readInt in interface BasicInputEOFException
public long readLong()
throws EOFException
BasicInput
readLong in interface BasicInputEOFException
public float readFloat()
throws EOFException
BasicInput
readFloat in interface BasicInputEOFException
public double readDouble()
throws EOFException
BasicInput
readDouble in interface BasicInputEOFExceptionpublic void close()
BasicInput
close in interface BasicInput
|
Copyright © 2004 CLRC: Central Laboratory of the Research Councils. All rights reserved. | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||