IOType - type of IOpublic abstract class PositionKnownWrapper<IOType extends IO> extends ConcurrentCloseable<IOException> implements IO.PositionKnown
| Modifier and Type | Class and Description |
|---|---|
static class |
PositionKnownWrapper.Readable
Add the capability to known on which position we are on a Readable.
|
IO.KnownSize, IO.OperationType, IO.OutputToInput, IO.PositionKnown, IO.ReadableByteStream, IO.Resizable, IO.Seekable, IO.Writable, IO.WritableByteStream, IO.WriterAsyncCloseableListenable.Impl| Modifier and Type | Field and Description |
|---|---|
protected IOType |
io |
protected ListenableLongProperty |
position |
| Constructor and Description |
|---|
PositionKnownWrapper(IOType io,
long position)
Constructor with initial position.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addPositionChangedListener(Consumer<Long> listener)
Register a listener to be called when position is changing.
|
void |
addPositionChangedListener(Runnable listener)
Register a listener to be called when position is changing.
|
protected IAsync<IOException> |
canStartReading() |
protected void |
closeResources(Async<IOException> ondone) |
protected IAsync<IOException> |
closeUnderlyingResources() |
long |
getPosition()
Return the current position.
|
byte |
getPriority()
Return the priority.
|
String |
getSourceDescription()
Describe the IO, which can be used for logging or debugging purposes.
|
TaskManager |
getTaskManager()
Return the TaskManager used for asynchronous operations.
|
IO |
getWrappedIO()
If this IO is wrapping another one (such as adding Buffered capabilities), this method returns it,
or null if it does not wrap another IO.
|
protected int |
read() |
protected int |
read(byte[] buffer,
int offset,
int len) |
protected int |
readAsync() |
protected AsyncSupplier<Integer,IOException> |
readAsync(ByteBuffer buffer,
Consumer<Pair<Integer,IOException>> ondone) |
protected int |
readFully(byte[] buffer) |
protected AsyncSupplier<Integer,IOException> |
readFullyAsync(ByteBuffer buffer,
Consumer<Pair<Integer,IOException>> ondone) |
protected int |
readFullySync(ByteBuffer buffer) |
protected AsyncSupplier<Integer,IOException> |
readFullySyncIfPossible(ByteBuffer buffer,
Consumer<Pair<Integer,IOException>> ondone) |
protected ByteBuffer |
readNextBuffer() |
protected AsyncSupplier<ByteBuffer,IOException> |
readNextBufferAsync(Consumer<Pair<ByteBuffer,IOException>> ondone) |
protected int |
readSync(ByteBuffer buffer) |
void |
removePositionChangedListener(Consumer<Long> listener)
Remove the given listener.
|
void |
removePositionChangedListener(Runnable listener)
Remove the given listener.
|
void |
setPriority(byte priority)
Set the priority of asynchronous operations.
|
protected int |
skip(int skip) |
protected AsyncSupplier<Long,IOException> |
skipAsync(long n,
Consumer<Pair<Long,IOException>> ondone) |
protected long |
skipSync(long n) |
addCloseListener, addCloseListener, close, closeAsync, isClosed, isClosing, lockClose, operation, operation, removeCloseListener, removeCloseListener, unlockCloseclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcancelClosed, error, errorCancelledlockClose, unlockCloseclosecloseAfter, closeAsyncaddCloseListener, addCloseListener, close, isClosed, removeCloseListener, removeCloseListenerprotected ListenableLongProperty position
public PositionKnownWrapper(IOType io, long position)
public void addPositionChangedListener(Consumer<Long> listener)
public void addPositionChangedListener(Runnable listener)
public void removePositionChangedListener(Consumer<Long> listener)
public void removePositionChangedListener(Runnable listener)
public String getSourceDescription()
IOgetSourceDescription in interface IOpublic IO getWrappedIO()
IOgetWrappedIO in interface IOpublic byte getPriority()
ConcurrentCloseablegetPriority in interface IOgetPriority in class ConcurrentCloseable<IOException>public void setPriority(byte priority)
IOsetPriority in interface IOpublic TaskManager getTaskManager()
IOgetTaskManager in interface IOpublic long getPosition()
IO.PositionKnowngetPosition in interface IO.PositionKnownprotected IAsync<IOException> closeUnderlyingResources()
closeUnderlyingResources in class ConcurrentCloseable<IOException>protected void closeResources(Async<IOException> ondone)
closeResources in class ConcurrentCloseable<IOException>protected IAsync<IOException> canStartReading()
protected int readSync(ByteBuffer buffer) throws IOException
IOExceptionprotected int readAsync()
throws IOException
IOExceptionprotected AsyncSupplier<Integer,IOException> readAsync(ByteBuffer buffer, Consumer<Pair<Integer,IOException>> ondone)
protected int readFullySync(ByteBuffer buffer) throws IOException
IOExceptionprotected AsyncSupplier<Integer,IOException> readFullyAsync(ByteBuffer buffer, Consumer<Pair<Integer,IOException>> ondone)
protected long skipSync(long n)
throws IOException
IOExceptionprotected AsyncSupplier<Long,IOException> skipAsync(long n, Consumer<Pair<Long,IOException>> ondone)
protected int read()
throws IOException
IOExceptionprotected int read(byte[] buffer,
int offset,
int len)
throws IOException
IOExceptionprotected int readFully(byte[] buffer)
throws IOException
IOExceptionprotected int skip(int skip)
throws IOException
IOExceptionprotected AsyncSupplier<ByteBuffer,IOException> readNextBufferAsync(Consumer<Pair<ByteBuffer,IOException>> ondone)
protected ByteBuffer readNextBuffer() throws IOException
IOExceptionprotected AsyncSupplier<Integer,IOException> readFullySyncIfPossible(ByteBuffer buffer, Consumer<Pair<Integer,IOException>> ondone)
Copyright © 2019. All rights reserved.