TrueZIP 6.8

de.schlichtherle.io.rof
Class MemoryMappedReadOnlyFile

java.lang.Object
  extended by de.schlichtherle.io.rof.AbstractReadOnlyFile
      extended by de.schlichtherle.io.rof.MemoryMappedReadOnlyFile
All Implemented Interfaces:
ReadOnlyFile

Deprecated. This class does not reliably work on the Windows platform, and hence its not used in TrueZIP. The reason is that the mapped file remains allocated until the garbage collector frees it even if the file channel and/or the RandomAccessFile has been closed. Subsequent delete/write operations on the file will then fail. For more information, please refer to http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4715154.

public class MemoryMappedReadOnlyFile
extends AbstractReadOnlyFile

A ReadOnlyFile implementation using channels to map the underlying file into memory. This class supports files larger than Integer.MAX_VALUE.

Version:
$Id: MemoryMappedReadOnlyFile.java,v 1.3 2010/08/16 10:55:48 christian_schlichtherle Exp $
Author:
Christian Schlichtherle

Constructor Summary
MemoryMappedReadOnlyFile(File file)
          Deprecated.  
 
Method Summary
 void close()
          Deprecated.  
 long getFilePointer()
          Deprecated.  
 long length()
          Deprecated.  
 int read()
          Deprecated.  
 int read(byte[] buf, int off, int len)
          Deprecated. Reads up to len bytes of data from this read only file into the given array.
 void seek(long fp)
          Deprecated. Sets the file pointer offset, measured from the beginning of this file, at which the next read occurs.
 
Methods inherited from class de.schlichtherle.io.rof.AbstractReadOnlyFile
read, readFully, readFully, skipBytes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MemoryMappedReadOnlyFile

public MemoryMappedReadOnlyFile(File file)
                         throws FileNotFoundException
Deprecated. 
Throws:
FileNotFoundException
Method Detail

length

public long length()
            throws IOException
Deprecated. 
Throws:
IOException

getFilePointer

public long getFilePointer()
                    throws IOException
Deprecated. 
Throws:
IOException

seek

public void seek(long fp)
          throws IOException
Deprecated. 
Description copied from interface: ReadOnlyFile
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:
fp - 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

public int read()
         throws IOException
Deprecated. 
Throws:
IOException

read

public int read(byte[] buf,
                int off,
                int len)
         throws IOException
Deprecated. 
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.

Parameters:
buf - 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
Deprecated. 
Throws:
IOException

TrueZIP 6.8

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