|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ReadOnlyFile
A minimal interface to allow random read only access to a file.
This interface is required by the class ZipFile
to
read a ZIP compatible file which may or may not be encrypted.
Method Summary | |
---|---|
void |
close()
|
long |
getFilePointer()
|
long |
length()
|
int |
read()
|
int |
read(byte[] b)
|
int |
read(byte[] b,
int off,
int len)
Reads up to len bytes of data from this read only file into
the given array. |
void |
readFully(byte[] b)
|
void |
readFully(byte[] b,
int off,
int len)
|
void |
seek(long pos)
Sets the file pointer offset, measured from the beginning of this file, at which the next read occurs. |
int |
skipBytes(int n)
Deprecated. Use seek(long) instead. |
Method Detail |
---|
long length() throws IOException
IOException
long getFilePointer() throws IOException
IOException
void seek(long pos) throws IOException
SimpleReadOnlyFile
subclasses
RandomAccessFile
and passes "r"
as a
parameter to the superclass constructor.
On the Windows platform, this implementation allows to seek past the
end of file, but on the Linux platform it doesn't.
pos
- The offset position, measured in bytes from the beginning
of the file, at which to set the file pointer.
IOException
- If pos
is less than 0
or if
an I/O error occurs.int read() throws IOException
IOException
int read(byte[] b) throws IOException
IOException
int read(byte[] b, int off, int len) throws IOException
len
bytes of data from this read only file into
the given array.
This method blocks until at least one byte of input is available.
b
- The buffer to fill with data.off
- The start offset of the data.len
- The maximum number of bytes to read.
-1
if there is
no more data because the end of the file has been reached.
IOException
- On any I/O related issue.void readFully(byte[] b) throws IOException
IOException
void readFully(byte[] b, int off, int len) throws IOException
IOException
int skipBytes(int n) throws IOException
seek(long)
instead.
IOException
void close() throws IOException
IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |