de.schlichtherle.io.rof
Interface ReadOnlyFile

All Known Implementing Classes:
AbstractReadOnlyFile, BufferedReadOnlyFile, ChannelReadOnlyFile, CipherReadOnlyFile, FastReadOnlyFile, FilterReadOnlyFile, MemoryMappedReadOnlyFile, RaesReadOnlyFile, SimpleReadOnlyFile

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.

Version:
TrueZIP 6.7
Author:
Christian Schlichtherle

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

length

long length()
            throws IOException
Throws:
IOException

getFilePointer

long getFilePointer()
                    throws IOException
Throws:
IOException

seek

void seek(long pos)
          throws IOException
Sets the file pointer offset, measured from the beginning of this file, at which the next read occurs. Whether the offset may be set beyond the end of the file is up to the implementor. For example, the 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.

Parameters:
pos - The offset position, measured in bytes from the beginning of the file, at which to set the file pointer.
Throws:
IOException - If pos is less than 0 or if an I/O error occurs.

read

int read()
         throws IOException
Throws:
IOException

read

int read(byte[] b)
         throws IOException
Throws:
IOException

read

int read(byte[] b,
         int off,
         int len)
         throws IOException
Reads up to 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.

Parameters:
b - The buffer to fill with data.
off - The start offset of the data.
len - The maximum number of bytes to read.
Returns:
The total number of bytes read, or -1 if there is no more data because the end of the file has been reached.
Throws:
IOException - On any I/O related issue.

readFully

void readFully(byte[] b)
               throws IOException
Throws:
IOException

readFully

void readFully(byte[] b,
               int off,
               int len)
               throws IOException
Throws:
IOException

skipBytes

int skipBytes(int n)
              throws IOException
Deprecated. Use seek(long) instead.

Throws:
IOException

close

void close()
           throws IOException
Throws:
IOException