public class MemoryMappedSeekableSource extends BaseSeekableSource
SeekableSource implementation based on MappedByteBuffer. To overcome the int limit of the MappedByteBuffer, this source implement a pagination algorithm allowing to
open files of any size. The size of the pages can be configured using the SeekableSources.MEMORY_MAPPED_PAGE_SIZE_PROPERTY system property.| Constructor and Description |
|---|
MemoryMappedSeekableSource(File file) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
long |
position() |
SeekableSource |
position(long position)
Sets the source position.
|
int |
read()
Reads a byte of data from this source.
|
int |
read(ByteBuffer dst) |
long |
size() |
SeekableSource |
view(long startingPosition,
long length) |
id, isOpen, requireOpenclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitasInputStream, back, back, forward, peek, peekBackpublic MemoryMappedSeekableSource(File file) throws IOException
IOExceptionpublic long position()
public long size()
public SeekableSource position(long position)
SeekableSourceposition - a non-negative long for the new positionpublic int read(ByteBuffer dst) throws IOException
IOExceptionpublic int read()
throws IOException
SeekableSource0x00-0xff ).-1 if there is no more data.IOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in interface Channelclose in class BaseSeekableSourceIOExceptionpublic SeekableSource view(long startingPosition, long length) throws IOException
SeekableSource. Reading from the view doesn't affect the SeekableSource position. Closing the
SeekableSource makes all the views unreadable but closing the view has no effect on the SeekableSource. A view may or may not work on a thread bound
copy of the SeekableSource so as a general rule it should not be created and handed to other threads..IOException - if something goes wrong while creating the viewCopyright © 2018 sejda. All rights reserved.