- java.lang.Object
-
- com.lowagie.text.pdf.MappedRandomAccessFile
-
- All Implemented Interfaces:
AutoCloseable
public class MappedRandomAccessFile extends Object implements AutoCloseable
AMappedByteBuffer
wrapped as aRandomAccessFile
- Author:
- Joakim Sandstroem Created on 6.9.2006
-
-
Constructor Summary
Constructors Constructor Description MappedRandomAccessFile(String filename, String mode)
Constructs a new MappedRandomAccessFile instance
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static boolean
clean(ByteBuffer buffer)
invokes the clean method on the ByteBuffer's cleanervoid
close()
Cleans the mapped bytebuffer and closes the channelprotected void
finalize()
Deprecated, for removal: This API element is subject to removal in a future version.FileChannel
getChannel()
long
getFilePointer()
long
length()
int
read()
int
read(byte[] bytes, int off, int len)
void
seek(long pos)
-
-
-
Constructor Detail
-
MappedRandomAccessFile
public MappedRandomAccessFile(String filename, String mode) throws IOException
Constructs a new MappedRandomAccessFile instance- Parameters:
filename
- Stringmode
- String r, w or rw- Throws:
FileNotFoundException
- on errorIOException
- on error
-
-
Method Detail
-
clean
public static boolean clean(ByteBuffer buffer)
invokes the clean method on the ByteBuffer's cleaner- Parameters:
buffer
- ByteBuffer- Returns:
- boolean true on success
-
getChannel
public FileChannel getChannel()
- Returns:
- FileChannel
- Since:
- 2.0.8
-
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 offsetlen
- 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
Cleans the mapped bytebuffer and closes the channel- Specified by:
close
in interfaceAutoCloseable
- Throws:
IOException
- on error- See Also:
RandomAccessFile.close()
-
finalize
@Deprecated(since="OpenPDF-2.0.2", forRemoval=true) protected void finalize() throws Throwable
Deprecated, for removal: This API element is subject to removal in a future version.invokes the close method- Overrides:
finalize
in classObject
- Throws:
Throwable
- See Also:
Object.finalize()
-
-