public class OutputToInput extends ConcurrentCloseable<IOException> implements IO.OutputToInput, IO.Writable, IO.Readable.Seekable
IO.Writable.Buffered, IO.Writable.SeekableIO.Seekable.SeekTypeIO.KnownSize, IO.OperationType, IO.OutputToInput, IO.PositionKnown, IO.Readable, IO.ReadableByteStream, IO.Resizable, IO.Writable, IO.WritableByteStream, IO.WriterAsyncCloseableListenable.Impl| Constructor and Description |
|---|
OutputToInput(T io,
String sourceDescription)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
IAsync<IOException> |
canStartReading()
Return a synchronization point that is unblocked when data is ready to be read.
|
IAsync<IOException> |
canStartWriting()
Return a synchronization point that is unblocked when data is ready to be written.
|
protected void |
closeResources(Async<IOException> ondone) |
protected IAsync<IOException> |
closeUnderlyingResources() |
void |
endOfData()
Signal that no more data will be written by the producer.
|
long |
getAvailableDataSize()
If available, return the size.
|
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.
|
boolean |
isFullDataAvailable()
Return true if endOfData has been already called.
|
AsyncSupplier<Integer,IOException> |
readAsync(ByteBuffer buffer,
Consumer<Pair<Integer,IOException>> ondone)
Asynchronous read operation.
|
AsyncSupplier<Integer,IOException> |
readAsync(long pos,
ByteBuffer buffer,
Consumer<Pair<Integer,IOException>> ondone)
Same as
IO.Readable.readAsync(ByteBuffer, Consumer) but read at the given position. |
AsyncSupplier<Integer,IOException> |
readFullyAsync(ByteBuffer buffer,
Consumer<Pair<Integer,IOException>> ondone)
Asynchronous read operation to fully fill the given buffer.
|
AsyncSupplier<Integer,IOException> |
readFullyAsync(long pos,
ByteBuffer buffer,
Consumer<Pair<Integer,IOException>> ondone)
Same as
IO.Readable.readFullyAsync(ByteBuffer, Consumer) but read at the given position. |
int |
readFullySync(ByteBuffer buffer)
Synchronous read operation to fully fill the given buffer.
|
int |
readFullySync(long pos,
ByteBuffer buffer)
Same as
IO.Readable.readFullySync(ByteBuffer) but read at the given position. |
int |
readSync(ByteBuffer buffer)
Read synchronously into the given buffer.
|
int |
readSync(long pos,
ByteBuffer buffer)
Same as
IO.Readable.readSync(ByteBuffer) but read at the given position. |
AsyncSupplier<Long,IOException> |
seekAsync(IO.Seekable.SeekType type,
long move,
Consumer<Pair<Long,IOException>> ondone)
Returns the new position.
|
long |
seekSync(IO.Seekable.SeekType type,
long move)
Returns the new position.
|
void |
setPriority(byte priority)
Set the priority of asynchronous operations.
|
void |
signalErrorBeforeEndOfData(IOException error)
Signal that no more data will be written by the producer because of an error.
|
AsyncSupplier<Long,IOException> |
skipAsync(long n,
Consumer<Pair<Long,IOException>> ondone)
Returns the number of bytes skipped.
|
long |
skipSync(long n)
Returns the number of bytes skipped.
|
AsyncSupplier<Integer,IOException> |
writeAsync(ByteBuffer buffer,
Consumer<Pair<Integer,IOException>> ondone)
Write asynchronously all bytes available in the given buffer at the current position.
|
int |
writeSync(ByteBuffer buffer)
Write synchronously all bytes available in the given buffer at the current position.
|
addCloseListener, addCloseListener, close, closeAsync, isClosed, isClosing, lockClose, operation, operation, removeCloseListener, removeCloseListener, unlockCloseclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitwriteAsyncreadAsync, readFullyAsyncreadAsync, readFullyAsync, skipAsyncseekAsynccancelClosed, error, errorCancelledlockClose, unlockCloseclosecloseAfter, closeAsyncaddCloseListener, addCloseListener, close, isClosed, removeCloseListener, removeCloseListenerpublic OutputToInput(T io,
String sourceDescription)
protected IAsync<IOException> closeUnderlyingResources()
closeUnderlyingResources in class ConcurrentCloseable<IOException>protected void closeResources(Async<IOException> ondone)
closeResources in class ConcurrentCloseable<IOException>public byte getPriority()
ConcurrentCloseablegetPriority in interface IOgetPriority in class ConcurrentCloseable<IOException>public void setPriority(byte priority)
IOsetPriority in interface IOpublic String getSourceDescription()
IOgetSourceDescription in interface IOpublic TaskManager getTaskManager()
IOgetTaskManager in interface IOpublic IO getWrappedIO()
IOgetWrappedIO in interface IOpublic void endOfData()
IO.OutputToInputendOfData in interface IO.OutputToInputpublic void signalErrorBeforeEndOfData(IOException error)
IO.OutputToInputsignalErrorBeforeEndOfData in interface IO.OutputToInputpublic boolean isFullDataAvailable()
IO.OutputToInputisFullDataAvailable in interface IO.OutputToInputpublic long getAvailableDataSize()
IO.OutputToInputgetAvailableDataSize in interface IO.OutputToInputpublic IAsync<IOException> canStartWriting()
IO.WritablecanStartWriting in interface IO.Writablepublic int writeSync(ByteBuffer buffer) throws IOException
IO.WritablewriteSync in interface IO.WritableIOExceptionpublic AsyncSupplier<Integer,IOException> writeAsync(ByteBuffer buffer, Consumer<Pair<Integer,IOException>> ondone)
IO.WritablewriteAsync in interface IO.Writablepublic IAsync<IOException> canStartReading()
IO.ReadablecanStartReading in interface IO.Readablepublic int readSync(long pos,
ByteBuffer buffer)
throws IOException
IO.Readable.SeekableIO.Readable.readSync(ByteBuffer) but read at the given position.
The current position is changed to the given position plus the number of bytes read.readSync in interface IO.Readable.SeekableIOExceptionpublic int readSync(ByteBuffer buffer) throws IOException
IO.ReadablereadSync in interface IO.Readablebuffer - buffer to fillIOExceptionpublic int readFullySync(ByteBuffer buffer) throws IOException
IO.ReadablereadFullySync in interface IO.Readablebuffer - the buffer to fillIOExceptionpublic int readFullySync(long pos,
ByteBuffer buffer)
throws IOException
IO.Readable.SeekableIO.Readable.readFullySync(ByteBuffer) but read at the given position.
The current position is changed to the given position plus the number of bytes read.readFullySync in interface IO.Readable.SeekableIOExceptionpublic AsyncSupplier<Integer,IOException> readAsync(ByteBuffer buffer, Consumer<Pair<Integer,IOException>> ondone)
IO.ReadablereadAsync in interface IO.Readablebuffer - buffer to fillondone - called before the returned AsyncWork is unblocked and its listeners are called.public AsyncSupplier<Integer,IOException> readAsync(long pos, ByteBuffer buffer, Consumer<Pair<Integer,IOException>> ondone)
IO.Readable.SeekableIO.Readable.readAsync(ByteBuffer, Consumer) but read at the given position.
The current position is changed to the given position plus the number of bytes read upon completion.readAsync in interface IO.Readable.Seekablepublic AsyncSupplier<Integer,IOException> readFullyAsync(ByteBuffer buffer, Consumer<Pair<Integer,IOException>> ondone)
IO.ReadablereadFullyAsync in interface IO.Readablebuffer - the buffer to fillondone - called before the returned AsyncWork is unblocked and its listeners are called.public AsyncSupplier<Integer,IOException> readFullyAsync(long pos, ByteBuffer buffer, Consumer<Pair<Integer,IOException>> ondone)
IO.Readable.SeekableIO.Readable.readFullyAsync(ByteBuffer, Consumer) but read at the given position.
The current position is changed to the given position plus the number of bytes read upon completion.readFullyAsync in interface IO.Readable.Seekablepublic long skipSync(long n)
throws IOException
IO.ReadableskipSync in interface IO.ReadableIOExceptionpublic AsyncSupplier<Long,IOException> skipAsync(long n, Consumer<Pair<Long,IOException>> ondone)
IO.ReadableskipAsync in interface IO.Readablepublic long getPosition()
IO.PositionKnowngetPosition in interface IO.PositionKnownpublic long seekSync(IO.Seekable.SeekType type, long move) throws IOException
IO.SeekableseekSync in interface IO.SeekableIOExceptionpublic AsyncSupplier<Long,IOException> seekAsync(IO.Seekable.SeekType type, long move, Consumer<Pair<Long,IOException>> ondone)
IO.SeekableseekAsync in interface IO.SeekableCopyright © 2019. All rights reserved.