public static class BufferedIO.ReadWrite extends BufferedIO implements IO.Writable.Seekable, IO.Writable.Buffered, IO.Resizable
BufferedIO.MemoryManagement, BufferedIO.ReadWriteIO.Seekable.SeekTypeIO.KnownSize, IO.OperationType, IO.OutputToInput, IO.PositionKnown, IO.Readable, IO.ReadableByteStream, IO.Resizable, IO.Writable, IO.WritableByteStream, IO.WriterAsyncCloseableListenable.ImplIO.Writable.Buffered, IO.Writable.SeekableIO.Readable.Buffered, IO.Readable.SeekablebufferSize, bufferTable, closing, firstBufferSize, io, memory, position, preLoadNextBuffer, size| Constructor and Description |
|---|
ReadWrite(T io,
int firstBufferSize,
int nextBuffersSize,
boolean preLoadNextBuffer)
Constructor.
|
ReadWrite(T io,
long size,
int firstBufferSize,
int nextBuffersSize,
boolean preLoadNextBuffer)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
IAsync<IOException> |
canStartWriting()
Return a synchronization point that is unblocked when data is ready to be written.
|
IAsync<IOException> |
flush()
Force to write buffered data to the underlying IO.
|
IAsync<IOException> |
setSizeAsync(long newSize)
Asynchronous resize.
|
void |
setSizeSync(long newSize)
Synchronous resize.
|
void |
write(byte value)
Write a byte.
|
void |
write(byte[] buffer,
int offset,
int length)
Write bytes from the given buffer.
|
AsyncSupplier<Integer,IOException> |
writeAsync(ByteBuffer buffer,
Consumer<Pair<Integer,IOException>> ondone)
Write asynchronously all bytes available in the given buffer at the current position.
|
AsyncSupplier<Integer,IOException> |
writeAsync(long pos,
ByteBuffer buffer,
Consumer<Pair<Integer,IOException>> ondone)
Same as
IO.Writable.writeAsync(ByteBuffer, Consumer) but at the given position. |
int |
writeSync(ByteBuffer buffer)
Write synchronously all bytes available in the given buffer at the current position.
|
int |
writeSync(long pos,
ByteBuffer buffer)
Same as
IO.Writable.writeSync(ByteBuffer) but at the given position. |
canStartReading, closeResources, closeUnderlyingResources, getBufferIndex, getBufferOffset, getBufferPosition, getPosition, getPriority, getSizeAsync, getSizeSync, getSourceDescription, getTaskManager, getWrappedIO, preLoadBuffer, read, read, readAsync, readAsync, readAsync, readFully, readFullyAsync, readFullyAsync, readFullySync, readFullySync, readFullySyncIfPossible, readFullySyncIfPossible, readNextBuffer, readNextBufferAsync, readSync, readSync, seekAsync, seekSync, setPriority, skip, skipAsync, skipSyncaddCloseListener, addCloseListener, close, closeAsync, isClosed, isClosing, lockClose, operation, operation, removeCloseListener, removeCloseListener, unlockCloseclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitwriteAsyncseekAsync, seekAsync, seekSyncgetPositioncancelClosed, error, errorCancelled, getPriority, getSourceDescription, getTaskManager, getWrappedIO, setPrioritylockClose, unlockCloseclosecloseAfter, closeAsyncaddCloseListener, addCloseListener, close, isClosed, removeCloseListener, removeCloseListenerwriteAsyncwritegetSizeAsync, getSizeSyncreadAsync, readFullyAsyncreadFullySyncIfPossible, readNextBufferAsyncreadAsync, readFullyAsync, skipAsyncreadBytepublic ReadWrite(T io,
long size,
int firstBufferSize,
int nextBuffersSize,
boolean preLoadNextBuffer)
public ReadWrite(T io,
int firstBufferSize,
int nextBuffersSize,
boolean preLoadNextBuffer)
throws IOException
IOExceptionpublic void write(byte value)
throws IOException
IO.WritableByteStreamwrite in interface IO.WritableByteStreamIOExceptionpublic void write(byte[] buffer,
int offset,
int length)
throws IOException
IO.WritableByteStreamwrite in interface IO.WritableByteStreamIOExceptionpublic int writeSync(long pos,
ByteBuffer buffer)
throws IOException
IO.Writable.SeekableIO.Writable.writeSync(ByteBuffer) but at the given position.
Note that if the IO implements Resizable, the behaviour is different when writing at
the end or beyond the end of the IO: if not resizable, it must throw an exception,
while a resizable IO should accept it except if the resize operation fails.writeSync in interface IO.Writable.SeekableIOExceptionpublic int writeSync(ByteBuffer buffer) throws IOException
IO.WritablewriteSync in interface IO.WritableIOExceptionpublic IAsync<IOException> canStartWriting()
IO.WritablecanStartWriting in interface IO.WritablecanStartWriting in interface IO.WritableByteStreampublic AsyncSupplier<Integer,IOException> writeAsync(long pos, ByteBuffer buffer, Consumer<Pair<Integer,IOException>> ondone)
IO.Writable.SeekableIO.Writable.writeAsync(ByteBuffer, Consumer) but at the given position.
Note that if the IO implements Resizable, the behaviour is different when writing at
the end or beyond the end of the IO: if not resizable, it must throw an exception,
while a resizable IO should accept it except if the resize operation fails.writeAsync in interface IO.Writable.Seekablepublic AsyncSupplier<Integer,IOException> writeAsync(ByteBuffer buffer, Consumer<Pair<Integer,IOException>> ondone)
IO.WritablewriteAsync in interface IO.Writablepublic void setSizeSync(long newSize)
throws IOException
IO.ResizablesetSizeSync in interface IO.ResizableIOExceptionpublic IAsync<IOException> setSizeAsync(long newSize)
IO.ResizablesetSizeAsync in interface IO.Resizablepublic IAsync<IOException> flush()
IO.Writable.Bufferedflush in interface IO.Writable.BufferedCopyright © 2019. All rights reserved.