public abstract class BufferedSelectionChannel<T extends SelectionChannel> extends WrapperSelectionChannel<T> implements BufferProcessor
| Constructor and Description |
|---|
BufferedSelectionChannel(Buffer buffer,
T source,
WakeupListener wakeupListener)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canLoop(Buffer buffer,
Object... args)
Indicates if the processing loop can continue.
|
void |
close()
Delegates to the wrapped channel.
|
Buffer |
getBuffer()
Returns the source buffer.
|
void |
onFillEof()
Called back when a fill operation returns with an EOF status.
|
void |
postProcess(int drained)
Does nothing by default.
|
int |
preProcess(int maxDrained,
Object... args)
Does nothing by default.
|
getRegistration, isBlocking, setRegistration, toStringgetWrappedChannel, isOpenclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcouldFill, onDrain, onFillpublic BufferedSelectionChannel(Buffer buffer, T source, WakeupListener wakeupListener)
buffer - The source byte buffer, typically remaining from previous read
processing.source - The source channel.wakeupListener - The wakeup listener that will be notified.public boolean canLoop(Buffer buffer, Object... args)
canLoop in interface BufferProcessorbuffer - The IO buffer to drain.args - The optional arguments to pass back to the callbacks.public void close()
throws IOException
WrapperChannelclose in interface Closeableclose in interface AutoCloseableclose in interface Channelclose in class WrapperChannel<T extends SelectionChannel>IOExceptionpublic Buffer getBuffer()
public void onFillEof()
onFillEof in interface BufferProcessorpublic void postProcess(int drained)
throws IOException
postProcess in interface BufferProcessordrained - The number of bytes drained or -1 if the filling source has
ended.IOExceptionpublic int preProcess(int maxDrained,
Object... args)
throws IOException
preProcess in interface BufferProcessormaxDrained - The maximum number of bytes drained by this call or 0 for
unlimited length.args - The optional arguments to pass back to the callbacks.IOExceptionCopyright © 2005–2016. All rights reserved.