public abstract class BufferedIO extends BufferingManaged
| Modifier and Type | Class and Description |
|---|---|
protected static class |
BufferedIO.Buffer
Buffer.
|
static class |
BufferedIO.ReadOnly
Read-only implementation of BufferedIO.
|
static class |
BufferedIO.ReadWrite
Read and write implementation of BufferedIO.
|
CloseableListenable.Impl| Modifier and Type | Field and Description |
|---|---|
protected List<BufferedIO.Buffer> |
buffers |
protected IO.Readable.Seekable |
io |
protected BufferingManager |
manager |
protected long |
pos |
protected long |
size |
protected boolean |
startReadSecondBufferWhenFirstBufferFullyRead |
| Modifier | Constructor and Description |
|---|---|
protected |
BufferedIO(IO.Readable.Seekable io,
int firstBufferSize,
int bufferSize,
long size,
boolean startReadSecondBufferWhenFirstBufferFullyRead) |
protected |
BufferedIO(IO.Readable.Seekable io,
int bufferSize,
long size) |
| Modifier and Type | Method and Description |
|---|---|
protected ISynchronizationPoint<IOException> |
canStartReading() |
protected void |
closeResources(SynchronizationPoint<Exception> ondone) |
protected ISynchronizationPoint<?> |
closeUnderlyingResources() |
protected AsyncWork<Void,IOException> |
decreaseSize(long newSize) |
protected ISynchronizationPoint<IOException> |
flush() |
protected int |
getBufferIndex(long pos) |
protected int |
getBufferOffset(long pos) |
protected long |
getBufferStart(int index) |
protected AsyncWork<Void,IOException> |
increaseSize(long newSize) |
protected void |
loadBuffer(int index) |
protected int |
read() |
protected int |
read(byte[] buf,
int offset,
int len) |
protected int |
readAsync() |
protected AsyncWork<Integer,IOException> |
readAsync(long pos,
ByteBuffer buf,
RunnableWithParameter<Pair<Integer,IOException>> ondone) |
protected int |
readFully(byte[] buf) |
protected AsyncWork<Integer,IOException> |
readFullyAsync(long pos,
ByteBuffer buf,
int alreadyDone,
RunnableWithParameter<Pair<Integer,IOException>> ondone) |
protected int |
readFullySync(long pos,
ByteBuffer buf) |
protected AsyncWork<ByteBuffer,IOException> |
readNextBufferAsync(RunnableWithParameter<Pair<ByteBuffer,IOException>> ondone) |
protected int |
readSync(long pos,
ByteBuffer buf) |
protected BufferedIO.Buffer |
useBufferAsync(int index)
Load the buffer if needed.
|
protected BufferedIO.Buffer |
useBufferSync(int index)
Load the buffer if needed and wait for it.
|
protected void |
write(byte b) |
protected void |
write(byte[] buf,
int offset,
int length) |
protected AsyncWork<Integer,IOException> |
writeAsync(long pos,
ByteBuffer buf,
int alreadyDone,
RunnableWithParameter<Pair<Integer,IOException>> ondone) |
protected int |
writeSync(long pos,
ByteBuffer buf,
int alreadyDone) |
addCloseListener, addCloseListener, close, closeAsync, getPriority, isClosed, isClosing, lockClose, operation, operation, removeCloseListener, removeCloseListener, unlockCloseprotected BufferingManager manager
protected IO.Readable.Seekable io
protected List<BufferedIO.Buffer> buffers
protected long size
protected long pos
protected boolean startReadSecondBufferWhenFirstBufferFullyRead
protected BufferedIO(IO.Readable.Seekable io, int bufferSize, long size) throws IOException
IOExceptionprotected BufferedIO(IO.Readable.Seekable io, int firstBufferSize, int bufferSize, long size, boolean startReadSecondBufferWhenFirstBufferFullyRead) throws IOException
IOExceptionprotected void loadBuffer(int index)
protected BufferedIO.Buffer useBufferAsync(int index)
protected BufferedIO.Buffer useBufferSync(int index) throws IOException
IOExceptionprotected int getBufferIndex(long pos)
protected int getBufferOffset(long pos)
protected long getBufferStart(int index)
protected ISynchronizationPoint<?> closeUnderlyingResources()
closeUnderlyingResources in class ConcurrentCloseableprotected void closeResources(SynchronizationPoint<Exception> ondone)
closeResources in class ConcurrentCloseableprotected ISynchronizationPoint<IOException> flush()
protected ISynchronizationPoint<IOException> canStartReading()
protected int read()
throws IOException
IOExceptionprotected int read(byte[] buf,
int offset,
int len)
throws IOException
IOExceptionprotected int readSync(long pos,
ByteBuffer buf)
throws IOException
IOExceptionprotected int readAsync()
throws IOException
IOExceptionprotected AsyncWork<Integer,IOException> readAsync(long pos, ByteBuffer buf, RunnableWithParameter<Pair<Integer,IOException>> ondone)
protected AsyncWork<ByteBuffer,IOException> readNextBufferAsync(RunnableWithParameter<Pair<ByteBuffer,IOException>> ondone)
protected int readFully(byte[] buf)
throws IOException
IOExceptionprotected int readFullySync(long pos,
ByteBuffer buf)
throws IOException
IOExceptionprotected AsyncWork<Integer,IOException> readFullyAsync(long pos, ByteBuffer buf, int alreadyDone, RunnableWithParameter<Pair<Integer,IOException>> ondone)
protected AsyncWork<Void,IOException> increaseSize(long newSize)
protected AsyncWork<Void,IOException> decreaseSize(long newSize)
protected AsyncWork<Integer,IOException> writeAsync(long pos, ByteBuffer buf, int alreadyDone, RunnableWithParameter<Pair<Integer,IOException>> ondone)
protected int writeSync(long pos,
ByteBuffer buf,
int alreadyDone)
throws IOException
IOExceptionprotected void write(byte[] buf,
int offset,
int length)
throws IOException
IOExceptionprotected void write(byte b)
throws IOException
IOExceptionCopyright © 2017. All rights reserved.