Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.lowagie.text.pdf
Class MappedRandomAccessFile

    java.lang.Object
      com.lowagie.text.pdf.MappedRandomAccessFile

    public class MappedRandomAccessFile

extends Object

A `MappedByteBuffer` wrapped as a `RandomAccessFile`

Author:
  Joakim Sandstroem Created on 6.9.2006

Field Summary
`private java.nio.channels.FileChannel` | `channel`
`private java.nio.MappedByteBuffer` | `mappedByteBuffer`

Constructor Summary
`MappedRandomAccessFile(String filename, String mode)` Constructs a new MappedRandomAccessFile instance

Method Summary
`static boolean` | `clean(java.nio.ByteBuffer buffer)` invokes the clean method on the ByteBuffer's cleaner
`void` | `close()`
`protected void` | `finalize()` invokes the close method
`long` | `getFilePointer()`
`private void` | `init(java.nio.channels.FileChannel channel, java.nio.channels.FileChannel.MapMode mapMode)` initializes the channel and mapped bytebuffer
`long` | `length()`
`int` | `read()`
`int` | `read(byte[] bytes, int off, int len)`
`void` | `seek(long pos)`

Methods inherited from class java.lang.Object
`clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### mappedByteBuffer

    private java.nio.MappedByteBuffer mappedByteBuffer

### channel

    private java.nio.channels.FileChannel channel

Constructor Detail

### MappedRandomAccessFile

    public MappedRandomAccessFile(String filename,
                                  String mode)
                           throws FileNotFoundException,
                                  IOException

  Constructs a new MappedRandomAccessFile instance

  Parameters:
    `filename` - String
    `mode` - String r, w or rw
  Throws:
    `FileNotFoundException`
    `IOException`

Method Detail

### init

    private void init(java.nio.channels.FileChannel channel,
                      java.nio.channels.FileChannel.MapMode mapMode)
               throws IOException

  initializes the channel and mapped bytebuffer

  Parameters:
    `channel` - FileChannel
    `mapMode` - FileChannel.MapMode
  Throws:
    `IOException`

### read

    public int read()

  Returns:
    int next integer or -1 on EOF
  See Also:
    `RandomAccessFile.read()`

### read

    public int read(byte[] bytes,
                    int off,
                    int len)

  Parameters:
    `bytes` - byte[]
    `off` - int offset
    `len` - int length
  Returns:
    int bytes read or -1 on EOF
  See Also:
    `RandomAccessFile.read(byte[], int, int)`

### getFilePointer

    public long getFilePointer()

  Returns:
    long
  See Also:
    `RandomAccessFile.getFilePointer()`

### seek

    public void seek(long pos)

  Parameters:
    `pos` - long position
  See Also:
    `RandomAccessFile.seek(long)`

### length

    public long length()

  Returns:
    long length
  See Also:
    `RandomAccessFile.length()`

### close

    public void close()
               throws IOException

  Throws:
    `IOException`
  See Also:
    `Cleans the mapped bytebuffer and closes the channel`

### finalize

    protected void finalize()
                     throws Throwable

  invokes the close method

  Overrides:
    `finalize` in class `Object`
  Throws:
    `Throwable`
  See Also:
    `Object.finalize()`

### clean

    public static boolean clean(java.nio.ByteBuffer buffer)

  invokes the clean method on the ByteBuffer's cleaner

  Parameters:
    `buffer` - ByteBuffer
  Returns:
    boolean true on success

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD