public class SimpleBufferedWritable extends ConcurrentCloseable implements IO.Writable.Buffered
IO.Writable.Buffered, IO.Writable.SeekableIO.KnownSize, IO.OperationType, IO.OutputToInput, IO.PositionKnown, IO.Readable, IO.ReadableByteStream, IO.Resizable, IO.Writable, IO.WritableByteStream, IO.WriterAsyncCloseableListenable.Impl| Constructor and Description |
|---|
SimpleBufferedWritable(IO.Writable out,
int bufferSize)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
ISynchronizationPoint<IOException> |
canStartWriting()
Return a synchronization point that is unblocked when data is ready to be written.
|
protected void |
closeResources(SynchronizationPoint<Exception> ondone) |
protected ISynchronizationPoint<?> |
closeUnderlyingResources() |
ISynchronizationPoint<IOException> |
flush()
Force to write buffered data to the underlying IO.
|
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.
|
void |
setPriority(byte priority)
Set the priority of asynchronous operations.
|
void |
write(byte b)
Write a byte.
|
void |
write(byte[] buf,
int offset,
int length)
Write bytes from the given buffer.
|
AsyncWork<Integer,IOException> |
writeAsync(ByteBuffer buf,
RunnableWithParameter<Pair<Integer,IOException>> ondone)
Write asynchronously all bytes available in the given buffer at the current position.
|
int |
writeSync(ByteBuffer buf)
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, waitwriteAsyncwritelockClose, unlockCloseclosecloseAsyncaddCloseListener, addCloseListener, close, isClosed, removeCloseListener, removeCloseListenerpublic SimpleBufferedWritable(IO.Writable out, int bufferSize)
public ISynchronizationPoint<IOException> canStartWriting()
IO.WritablecanStartWriting in interface IO.WritablecanStartWriting in interface IO.WritableByteStreampublic ISynchronizationPoint<IOException> flush()
IO.Writable.Bufferedflush in interface IO.Writable.Bufferedpublic void write(byte b)
throws IOException
IO.WritableByteStreamwrite in interface IO.WritableByteStreamIOExceptionpublic void write(byte[] buf,
int offset,
int length)
throws IOException
IO.WritableByteStreamwrite in interface IO.WritableByteStreamIOExceptionpublic int writeSync(ByteBuffer buf) throws IOException
IO.WritablewriteSync in interface IO.WritableIOExceptionpublic AsyncWork<Integer,IOException> writeAsync(ByteBuffer buf, RunnableWithParameter<Pair<Integer,IOException>> ondone)
IO.WritablewriteAsync in interface IO.Writablepublic String getSourceDescription()
IOgetSourceDescription in interface IOpublic IO getWrappedIO()
IOgetWrappedIO in interface IOpublic byte getPriority()
ConcurrentCloseablegetPriority in interface IOgetPriority in class ConcurrentCloseablepublic void setPriority(byte priority)
IOsetPriority in interface IOpublic TaskManager getTaskManager()
IOgetTaskManager in interface IOprotected ISynchronizationPoint<?> closeUnderlyingResources()
closeUnderlyingResources in class ConcurrentCloseableprotected void closeResources(SynchronizationPoint<Exception> ondone)
closeResources in class ConcurrentCloseableCopyright © 2018. All rights reserved.