com.lowagie.text.pdf
public class MappedRandomAccessFile extends java.lang.Object
MappedByteBuffer
wrapped as a RandomAccessFile
Modifier and Type | Field and Description |
---|---|
private java.nio.channels.FileChannel |
channel |
private java.nio.MappedByteBuffer |
mappedByteBuffer |
Constructor and Description |
---|
MappedRandomAccessFile(java.lang.String filename,
java.lang.String mode)
Constructs a new MappedRandomAccessFile instance
|
Modifier and Type | Method and Description |
---|---|
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
|
java.nio.channels.FileChannel |
getChannel() |
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) |
private java.nio.MappedByteBuffer mappedByteBuffer
private java.nio.channels.FileChannel channel
public MappedRandomAccessFile(java.lang.String filename, java.lang.String mode) throws java.io.FileNotFoundException, java.io.IOException
filename
- Stringmode
- String r, w or rwjava.io.FileNotFoundException
java.io.IOException
private void init(java.nio.channels.FileChannel channel, java.nio.channels.FileChannel.MapMode mapMode) throws java.io.IOException
channel
- FileChannelmapMode
- FileChannel.MapModejava.io.IOException
public java.nio.channels.FileChannel getChannel()
public int read()
RandomAccessFile.read()
public int read(byte[] bytes, int off, int len)
bytes
- byte[]off
- int offsetlen
- int lengthRandomAccessFile.read(byte[], int, int)
public long getFilePointer()
RandomAccessFile.getFilePointer()
public void seek(long pos)
pos
- long positionRandomAccessFile.seek(long)
public long length()
RandomAccessFile.length()
public void close() throws java.io.IOException
java.io.IOException
Cleans the mapped bytebuffer and closes the channel
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
Object.finalize()
public static boolean clean(java.nio.ByteBuffer buffer)
buffer
- ByteBuffer