| uk.org.ponder.streamutil.RandomAccessRead
All known Subclasses: uk.org.ponder.streamutil.RandomAccessReadWrapper,
RandomAccessRead | public interface RandomAccessRead (Code) | | This interface abstracts the properties of a read-only random access file.
|
Method Summary | |
public void | close() Closes this RandomAccessFile. | public long | getFilePointer() Returns the current offset in this file. | public long | length() Returns the length of the file. | public int | read() Reads a byte of data from this file. | public int | read(byte b, int off, int len) Reads up to len bytes of data from this file into an array of bytes. | public void | seek(long pos) Sets the file-pointer offset, measured from the beginning of this file,
at which the next read or write occurs. | public void | setStreamClosedCallback(StreamClosedCallback callback) Sets the callback used to report when this file is closed. |
getFilePointer | public long getFilePointer() throws IOException(Code) | | Returns the current offset in this file.
the offset from the beginning of the file, in bytes, at which the next read or write occurs. exception: IOException - if an I/O error occurs. |
length | public long length() throws IOException(Code) | | Returns the length of the file.
The length of the file as a long . exception: IOException - if an I/O error occurs. |
read | public int read() throws IOException(Code) | | Reads a byte of data from this file. This method blocks if no input is yet available.
the next byte of data, or -1 if the end of the file is reached. exception: IOException - if an I/O error occurs. |
read | public int read(byte b, int off, int len) throws IOException(Code) | | Reads up to len bytes of data from this file into an array of bytes.
This method blocks until at least one byte of input is available.
Parameters: b - the buffer into which the data is read. Parameters: off - the start offset of the data. Parameters: len - the maximum number of bytes read. the total number of bytes read into the buffer, or -1 if there is no more data because the end of the file has been reached. exception: IOException - if an I/O error occurs. |
seek | public void seek(long pos) throws IOException(Code) | | Sets the file-pointer offset, measured from the beginning of this file,
at which the next read or write occurs. The offset may be set beyond the end of the file.
Setting the offset beyond the end of the file does not change the file length.
The file length will change only by writing after the offset has been set beyond the end
of the file.
Parameters: pos - the offset position, measured in bytes from the beginning of the file, at which to set the file pointer. exception: IOException - if an I/O error occurs. |
setStreamClosedCallback | public void setStreamClosedCallback(StreamClosedCallback callback)(Code) | | Sets the callback used to report when this file is closed.
Parameters: callback - A callback used to report when this file is closed. |
|
|