public class SimpleBufferedWritable extends ConcurrentCloseable<IOException> 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 |
|---|---|
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() |
IAsync<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.
|
AsyncSupplier<Integer,IOException> |
writeAsync(ByteBuffer buf,
Consumer<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, waitwriteAsyncwritecancelClosed, error, errorCancelledlockClose, unlockCloseclosecloseAfter, closeAsyncaddCloseListener, addCloseListener, close, isClosed, removeCloseListener, removeCloseListenerpublic SimpleBufferedWritable(IO.Writable out, int bufferSize)
public IAsync<IOException> canStartWriting()
IO.WritablecanStartWriting in interface IO.WritablecanStartWriting in interface IO.WritableByteStreampublic IAsync<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 AsyncSupplier<Integer,IOException> writeAsync(ByteBuffer buf, Consumer<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 ConcurrentCloseable<IOException>public void setPriority(byte priority)
IOsetPriority in interface IOpublic TaskManager getTaskManager()
IOgetTaskManager in interface IOprotected IAsync<IOException> closeUnderlyingResources()
closeUnderlyingResources in class ConcurrentCloseable<IOException>protected void closeResources(Async<IOException> ondone)
closeResources in class ConcurrentCloseable<IOException>Copyright © 2019. All rights reserved.