This repository has been archived by the owner on Jul 21, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 90
com.github.junrar.io.IReadOnlyAccess
SeregaMamonT edited this page Jan 22, 2013
·
3 revisions
IReadOnlyAccess interface should be implemented by class representing data storage with read only random access. This interface is used by Archive to read data of the Volume. It should be implemented when a new data storage is required.
-
long getPosition() throws IOException
- return the current position of the cursor in the data storage -
void setPosition(long pos) throws IOException
- moves the cursor to the specified position pos in the data storage -
int read() throws IOException
- reads a single byte at the cursor's position and increments the position of the cursor. -
int read(byte[] buffer, int off, int count) throws IOException
- reads a block of count bytes in the data storage and writes them into buffer starting from off element; returns the actual number of read bytes. -
int readFully(byte[] buffer, int count) throws IOException
- reads exactly count bytes (or less if storageLength - cursorPosition < count) from the data storage starting from the current cursor's postion and writes them to buffer. Returns the actual number of read bytes.
Currently, there are 4 implementations of this interface in the library:
- ReadOnlyAccessFile - based on
java.io.File
- ReadOnlyAccessByteArray - based on
byte[]
- RandomAccessContentAccess - based on
org.apache.commons.vfs2.FileObject
- InputStreamReadOnlyAccessFile - takes for input
java.io.InputStream
and bufferes read data to have random access to it.