TrueZIP Kernel 7.0-rc2

de.schlichtherle.truezip.socket
Class ConcurrentInputShop.ConcurrentReadOnlyFile

java.lang.Object
  extended by de.schlichtherle.truezip.rof.AbstractReadOnlyFile
      extended by de.schlichtherle.truezip.rof.DecoratingReadOnlyFile
          extended by de.schlichtherle.truezip.socket.ConcurrentInputShop.ConcurrentReadOnlyFile
All Implemented Interfaces:
ReadOnlyFile, Closeable
Enclosing class:
ConcurrentInputShop<E extends Entry>

@NotThreadSafe
private final class ConcurrentInputShop.ConcurrentReadOnlyFile
extends DecoratingReadOnlyFile


Field Summary
 
Fields inherited from class de.schlichtherle.truezip.rof.DecoratingReadOnlyFile
delegate
 
Constructor Summary
ConcurrentInputShop.ConcurrentReadOnlyFile(ReadOnlyFile rof)
           
 
Method Summary
 void close()
          Closes this read-only file and releases any non-heap resources allocated for it.
protected  void finalize()
          The finalizer in this class forces this input read only file to close.
 long getFilePointer()
          Returns the current byte position in the file as a zero-based index.
 long length()
          Returns the length of the file in bytes.
 int read()
          Reads and returns the next byte or -1 if the end of the file has been reached.
 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 seek(long pos)
          Sets the current byte position in the file as a zero-based index at which the next read occurs.
 
Methods inherited from class de.schlichtherle.truezip.rof.DecoratingReadOnlyFile
toString
 
Methods inherited from class de.schlichtherle.truezip.rof.AbstractReadOnlyFile
read, readFully, readFully
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConcurrentInputShop.ConcurrentReadOnlyFile

ConcurrentInputShop.ConcurrentReadOnlyFile(ReadOnlyFile rof)
Method Detail

length

public long length()
            throws IOException
Description copied from interface: ReadOnlyFile
Returns the length of the file in bytes.

Specified by:
length in interface ReadOnlyFile
Overrides:
length in class DecoratingReadOnlyFile
Throws:
IOException

getFilePointer

public long getFilePointer()
                    throws IOException
Description copied from interface: ReadOnlyFile
Returns the current byte position in the file as a zero-based index.

Specified by:
getFilePointer in interface ReadOnlyFile
Overrides:
getFilePointer in class DecoratingReadOnlyFile
Throws:
IOException

seek

public void seek(long pos)
          throws IOException
Description copied from interface: ReadOnlyFile
Sets the current byte position in the file as a zero-based index 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 DefaultReadOnlyFile subclass RandomAccessFile passes "r" as a parameter to the superclass constructor. With Sun's JSE implementation, on the Windows platform this implementation allows to seek past the end of file, but on the Linux platform it doesn't.

Specified by:
seek in interface ReadOnlyFile
Overrides:
seek in class DecoratingReadOnlyFile
Parameters:
pos - The current byte position as a zero-based index.
Throws:
IOException - If pos is less than 0 or if an I/O error occurs.

read

public int read()
         throws IOException
Description copied from interface: ReadOnlyFile
Reads and returns the next byte or -1 if the end of the file has been reached.

Specified by:
read in interface ReadOnlyFile
Overrides:
read in class DecoratingReadOnlyFile
Throws:
IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws IOException
Description copied from interface: ReadOnlyFile
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.

Specified by:
read in interface ReadOnlyFile
Overrides:
read in class DecoratingReadOnlyFile
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.

close

public void close()
           throws IOException
Description copied from interface: ReadOnlyFile
Closes this read-only file and releases any non-heap resources allocated for it.

Specified by:
close in interface ReadOnlyFile
Specified by:
close in interface Closeable
Overrides:
close in class DecoratingReadOnlyFile
Throws:
IOException

finalize

protected void finalize()
                 throws Throwable
The finalizer in this class forces this input read only file to close. This ensures that an input target can be updated although the client application may have "forgot" to close this instance before.

Overrides:
finalize in class Object
Throws:
Throwable

TrueZIP Kernel 7.0-rc2

Copyright © 2005-2011 Schlichtherle IT Services. All Rights Reserved.