public static class SubIO.Readable.Seekable.Buffered extends SubIO.Readable.Seekable implements IO.Readable.Buffered
SubIO.Readable.Seekable.BufferedSubIO.Readable, SubIO.ReadWrite, SubIO.WritableIO.Readable.Buffered, IO.Readable.SeekableIO.KnownSize, IO.OperationType, IO.OutputToInput, IO.PositionKnown, IO.Readable, IO.ReadableByteStream, IO.Resizable, IO.Writable, IO.WritableByteStream, IO.WriterAsyncCloseableListenable.ImplIO.Seekable.SeekTypecloseContainer, description, io, pos, size, start| Constructor and Description |
|---|
Buffered(T src,
long start,
long size,
String description,
boolean closeSrcOnClose)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
IAsync<IOException> |
canStartReading()
Return a synchronization point that is unblocked when data is ready to be read.
|
int |
read()
Read next byte.
|
int |
read(byte[] buffer,
int offset,
int len)
Read bytes into the given buffer, starting to store them at the given offset, and with the given maximum number of bytes.
|
int |
readAsync()
Read a single byte if possible.
|
int |
readFully(byte[] buffer)
Read bytes to fill the given buffer, and return the number of bytes read which is less than the
size of the buffer only if the end of the IO is reached, and so may return 0.
|
AsyncSupplier<Integer,IOException> |
readFullySyncIfPossible(ByteBuffer buffer,
Consumer<Pair<Integer,IOException>> ondone)
While readAsync methods are supposed to do the job in a separate thread, this method
fills the given buffer synchronously if enough data is already buffered, else it finishes asynchronously.
|
ByteBuffer |
readNextBuffer()
Retrieve a buffer of bytes in the most efficient way depending on the implementation of Buffered.
Its returns the immediately available bytes with a minimum of operations. |
AsyncSupplier<ByteBuffer,IOException> |
readNextBufferAsync(Consumer<Pair<ByteBuffer,IOException>> ondone)
Retrieve a buffer of bytes in the most efficient way depending on the implementation of Buffered.
This method is similar to readAsync, it reads some bytes that are immediately available with a minimum of operations. |
int |
skip(int skip)
Same as
IO.Readable.skipSync(long) but limited to an integer. |
readAsync, readAsync, readFullyAsync, readFullyAsync, readFullySync, readFullySync, readSync, readSync, seekAsync, seekSync, skipAsync, skipSynccanStartWriting, closeResources, closeUnderlyingResources, getPosition, getPriority, getSizeAsync, getSizeSync, getSourceDescription, getTaskManager, getWrappedIO, setPriority, writeAsync, writeAsync, writeSync, writeSyncaddCloseListener, addCloseListener, close, closeAsync, isClosed, isClosing, lockClose, operation, operation, removeCloseListener, removeCloseListener, unlockCloseclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitreadFullySyncIfPossible, readNextBufferAsyncreadAsync, readAsync, readFullyAsync, readFullyAsync, readFullySync, readSync, skipAsync, skipAsync, skipSyncreadBytecancelClosed, error, errorCancelled, getPriority, getSourceDescription, getTaskManager, getWrappedIO, setPrioritylockClose, unlockCloseclosecloseAfter, closeAsyncaddCloseListener, addCloseListener, close, isClosed, removeCloseListener, removeCloseListenerreadAsync, readFullyAsyncseekAsyncgetPositionpublic Buffered(T src,
long start,
long size,
String description,
boolean closeSrcOnClose)
public IAsync<IOException> canStartReading()
IO.ReadablecanStartReading in interface IO.ReadablecanStartReading in interface IO.ReadableByteStreamcanStartReading in class SubIO.Readable.Seekablepublic int read()
throws IOException
IO.ReadableByteStreamread in interface IO.ReadableByteStreamIOExceptionpublic int read(byte[] buffer,
int offset,
int len)
throws IOException
IO.ReadableByteStreamread in interface IO.ReadableByteStreamIOExceptionpublic int readFully(byte[] buffer)
throws IOException
IO.ReadableByteStreamreadFully in interface IO.ReadableByteStreamIOExceptionpublic AsyncSupplier<Integer,IOException> readFullySyncIfPossible(ByteBuffer buffer, Consumer<Pair<Integer,IOException>> ondone)
IO.Readable.BufferedreadFullySyncIfPossible in interface IO.Readable.Bufferedpublic int readAsync()
throws IOException
IO.Readable.BufferedreadAsync in interface IO.Readable.BufferedIOExceptionpublic int skip(int skip)
IO.ReadableByteStreamIO.Readable.skipSync(long) but limited to an integer.skip in interface IO.ReadableByteStreampublic AsyncSupplier<ByteBuffer,IOException> readNextBufferAsync(Consumer<Pair<ByteBuffer,IOException>> ondone)
IO.Readable.BufferedreadNextBufferAsync in interface IO.Readable.Bufferedpublic ByteBuffer readNextBuffer() throws IOException
IO.Readable.BufferedreadNextBuffer in interface IO.Readable.BufferedIOExceptionCopyright © 2019. All rights reserved.