|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.foray.common.io.AbstractRandomAccessInput
org.foray.common.io.RandomAccessInputFile
public class RandomAccessInputFile
Implementation of RandomInput that uses a RandomAccessFile to do the io work.
Constructor Summary | |
---|---|
RandomAccessInputFile(File file)
Constructor. |
Method Summary | |
---|---|
String |
getDescription()
Provides some kind of description of this item, useful in user messages. |
InputStream |
getInputStream()
Return the input as an InputStream. |
long |
getOffset()
Returns the current offset in this input. |
long |
length()
Returns the length of this input. |
boolean |
readBoolean()
|
byte |
readByte()
|
char |
readChar()
|
double |
readDouble()
|
float |
readFloat()
|
void |
readFully(byte[] b)
|
void |
readFully(byte[] b,
int off,
int len)
|
int |
readInt()
|
String |
readLine()
|
long |
readLong()
|
short |
readShort()
|
int |
readUnsignedByte()
|
int |
readUnsignedShort()
|
String |
readUTF()
|
void |
seek(long offset)
Sets the input pointer offset, measured from the beginning of the input, at which the next read occurs. |
int |
skipBytes(int add)
|
Methods inherited from class org.foray.common.io.AbstractRandomAccessInput |
---|
createRandomAccessInput, createRandomAccessInput, createRandomAccessInput, readFixed16x16Signed, readNullTerminatedString, readShortLoHi, readString, readStringASCII, readTerminatedString, readUnsignedInt, readUnsignedIntLoHi, readUnsignedShortLoHi |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RandomAccessInputFile(File file) throws IOException
file
- The wrapped file to be read.
IOException
- For error opening or reading file
.Method Detail |
---|
public void seek(long offset) throws IOException
RandomAccessInput
Sets the input pointer offset, measured from the beginning of the input, at which the next read occurs. The offset may be set beyond the end of the input. Setting the offset beyond the end of the input does not change the input length.
This method is based on RandomAccessFile.seek(long)
.
offset
- The offset position, measured in bytes from the beginning of
the input, at which to set the input pointer.
IOException
- If pos
is less than 0
, or if an I/O error occurs.RandomAccessFile.seek(long)
public int skipBytes(int add) throws IOException
IOException
public long length() throws IOException
RandomAccessInput
Returns the length of this input.
This method is based on RandomAccessFile.length()
.
IOException
- If an I/O error occurs.RandomAccessFile.length()
public byte readByte() throws IOException
IOException
public final int readUnsignedByte() throws IOException
IOException
public final short readShort() throws IOException
IOException
public final int readUnsignedShort() throws IOException
IOException
public final double readDouble() throws IOException
IOException
public final boolean readBoolean() throws IOException
IOException
public final void readFully(byte[] b) throws IOException
IOException
public final void readFully(byte[] b, int off, int len) throws IOException
IOException
public final long readLong() throws IOException
IOException
public final float readFloat() throws IOException
IOException
public final char readChar() throws IOException
IOException
public final String readUTF() throws IOException
IOException
public final int readInt() throws IOException
IOException
public final String readLine() throws IOException
IOException
public long getOffset() throws IOException
RandomAccessInput
Returns the current offset in this input.
This method is based on RandomAccessFile.getFilePointer()
.
IOException
- If an I/O error occurs.RandomAccessFile.getFilePointer()
public String getDescription()
RandomAccessInput
public InputStream getInputStream() throws IOException
RandomAccessInput
IOException
- If an I/O error occurs.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |