public class BufferedSeekableSource extends BaseSeekableSource
SeekableSource wrapping an existing one and providing buffered read. When a read method is called, a SeekableSources.INPUT_BUFFER_SIZE_PROPERTY long chunk of
bytes is read from the underlying source and stored in memory. Subsequent reads are served from the in memory buffer until they fall outside its range, at that point a new
buffer is read from the wrapped source.| Constructor and Description |
|---|
BufferedSeekableSource(SeekableSource wrapped) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
long |
position() |
SeekableSource |
position(long newPosition)
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) |
protected SeekableSource |
wrapped() |
id, isOpen, requireOpenclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitasInputStream, back, back, forward, peek, peekBackpublic BufferedSeekableSource(SeekableSource wrapped)
public long position()
public SeekableSource position(long newPosition) throws IOException
SeekableSourcenewPosition - a non-negative long for the new positionIOExceptionpublic long size()
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in interface Channelclose in class BaseSeekableSourceIOExceptionpublic int read(ByteBuffer dst) throws IOException
IOExceptionpublic int read()
throws IOException
SeekableSource0x00-0xff ).-1 if there is no more data.IOExceptionprotected SeekableSource wrapped()
public 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.