|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.Reader
org.biojava.utils.io.RandomAccessReader
public class RandomAccessReader
RandomAccessReader extends Reader to
provide a means to create buffered Readers from
RandomAccessFiles.
| Field Summary |
|---|
| Fields inherited from class java.io.Reader |
|---|
lock |
| Constructor Summary | |
|---|---|
RandomAccessReader(RandomAccessFile raf)
Creates a new RandomAccessReader wrapping the
RandomAccessFile and using a default-sized buffer
(8192 bytes). |
|
RandomAccessReader(RandomAccessFile raf,
int sz)
Creates a new RandomAccessReader wrapping the
RandomAccessFile and using a buffer of the
specified size. |
|
| Method Summary | |
|---|---|
void |
close()
close closes the underlying
RandomAccessFile. |
long |
getFilePointer()
getFilePointer returns the effective position of
the pointer in the underlying RandomAccessFile. |
long |
length()
length returns the length of the underlying
RandomAccessFile. |
int |
read()
read reads one byte from the underlying
RandomAccessFile. |
int |
read(char[] cbuf,
int off,
int len)
read reads from the underlying
RandomAccessFile into an array. |
void |
seek(long pos)
seek moves the pointer to the specified position. |
| Methods inherited from class java.io.Reader |
|---|
mark, markSupported, read, read, ready, reset, skip |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RandomAccessReader(RandomAccessFile raf)
throws IOException
RandomAccessReader wrapping the
RandomAccessFile and using a default-sized buffer
(8192 bytes).
raf - a RandomAccessFile to wrap.
IOException - if an error occurs.
public RandomAccessReader(RandomAccessFile raf,
int sz)
throws IOException
RandomAccessReader wrapping the
RandomAccessFile and using a buffer of the
specified size.
raf - a RandomAccessFile to wrap.sz - an int buffer size.
IOException| Method Detail |
|---|
public void close()
throws IOException
close closes the underlying
RandomAccessFile.
close in interface Closeableclose in class ReaderIOException - if an error occurs.
public long length()
throws IOException
length returns the length of the underlying
RandomAccessFile.
long.
IOException - if an error occurs.
public final int read()
throws IOException
read reads one byte from the underlying
RandomAccessFile.
read in class Readerint, -1 if the end of the stream has
been reached.
IOException - if an error occurs.
public int read(char[] cbuf,
int off,
int len)
throws IOException
read reads from the underlying
RandomAccessFile into an array.
read in class Readercbuf - a char [] array to read into.off - an int offset in the array at which to
start storing chars.len - an int maximum number of char to read.
int number of chars read, or -1 if the
end of the stream has been reached.
IOException - if an error occurs.
public long getFilePointer()
throws IOException
getFilePointer returns the effective position of
the pointer in the underlying RandomAccessFile.
long offset.
IOException - if an error occurs.
public void seek(long pos)
throws IOException
seek moves the pointer to the specified position.
pos - a long offset.
IOException - if an error occurs.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||