|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.illinois.cs.cogcomp.lbj.coref.util.io.RandomAccessByteBuffer
public class RandomAccessByteBuffer
Loads and stores a buffer of bytes from a source such as
a InputStream, and provides methods to read
in a random access fashion.
Suitable as a drop in replacement for a read-only RandomAccessFile,
with any data source.
| Field Summary | |
|---|---|
protected byte[] |
bytes
|
protected long |
cursor
|
| Constructor Summary | |
|---|---|
RandomAccessByteBuffer(java.io.InputStream in)
Creates a data-buffer by reading all input from the input stream, and storing it in a byte buffer. |
|
| Method Summary | |
|---|---|
long |
getFilePointer()
Returns the current offset in the data, in bytes. |
long |
length()
Gets the number of bytes of data. |
int |
read()
Reads a byte of data from the cursor position. |
void |
seek(long pos)
Sets the offset in the data, in bytes. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected long cursor
protected byte[] bytes
| Constructor Detail |
|---|
public RandomAccessByteBuffer(java.io.InputStream in)
in - The stream from which to read the data.| Method Detail |
|---|
public long getFilePointer()
throws java.io.IOException
RandomAccessData
getFilePointer in interface RandomAccessDatajava.io.IOException - if an I/O error is encountered.
public void seek(long pos)
throws java.io.IOException
RandomAccessData
seek in interface RandomAccessDatapos - The desired offset, in bytes.
java.io.IOException - if pos is negative, or if an I/O error
is encountered.
public long length()
throws java.io.IOException
RandomAccessData
length in interface RandomAccessDatajava.io.IOException - if an I/O error is encountered.public int read()
RandomAccessInputInputStream's read method.
read in interface RandomAccessInput
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||