Package com.lowagie.text.pdf
Class MappedRandomAccessFile
java.lang.Object
com.lowagie.text.pdf.MappedRandomAccessFile
- All Implemented Interfaces:
AutoCloseable
A
MappedByteBuffer
wrapped as a RandomAccessFile
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMappedRandomAccessFile
(String filename, String mode) Constructs a new MappedRandomAccessFile instance -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
clean
(ByteBuffer buffer) invokes the clean method on the ByteBuffer's cleanerprivate static boolean
cleanJava11
(ByteBuffer buffer) void
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.long
private void
init
(FileChannel channel, FileChannel.MapMode mapMode) initializes the channel and mapped bytebufferlong
length()
int
read()
int
read
(byte[] bytes, int off, int len) void
seek
(long pos)
-
Field Details
-
mappedByteBuffer
-
channel
-
-
Constructor Details
-
MappedRandomAccessFile
Constructs a new MappedRandomAccessFile instance- Parameters:
filename
- Stringmode
- String r, w or rw- Throws:
FileNotFoundException
- on errorIOException
- on error
-
-
Method Details
-
clean
invokes the clean method on the ByteBuffer's cleaner- Parameters:
buffer
- ByteBuffer- Returns:
- boolean true on success
-
cleanJava11
-
init
initializes the channel and mapped bytebuffer- Parameters:
channel
- FileChannelmapMode
- FileChannel.MapMode- Throws:
IOException
-
getChannel
- Returns:
- FileChannel
- Since:
- 2.0.8
-
read
public int read()- Returns:
- int next integer or -1 on EOF
- See Also:
-
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:
-
getFilePointer
public long getFilePointer()- Returns:
- long
- See Also:
-
seek
public void seek(long pos) - Parameters:
pos
- long position- See Also:
-
length
public long length()- Returns:
- long length
- See Also:
-
close
Cleans the mapped bytebuffer and closes the channel- Specified by:
close
in interfaceAutoCloseable
- Throws:
IOException
- on error- See Also:
-
finalize
Deprecated, for removal: This API element is subject to removal in a future version.invokes the close method
-