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, toString
getWrappedChannel, isOpen
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
couldFill, onDrain, onFill
public 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 BufferProcessor
buffer
- The IO buffer to drain.args
- The optional arguments to pass back to the callbacks.public void close() throws IOException
WrapperChannel
close
in interface Closeable
close
in interface AutoCloseable
close
in interface Channel
close
in class WrapperChannel<T extends SelectionChannel>
IOException
public Buffer getBuffer()
public void onFillEof()
onFillEof
in interface BufferProcessor
public void postProcess(int drained) throws IOException
postProcess
in interface BufferProcessor
drained
- The number of bytes drained or -1 if the filling source has
ended.IOException
public int preProcess(int maxDrained, Object... args) throws IOException
preProcess
in interface BufferProcessor
maxDrained
- The maximum number of bytes drained by this call or 0 for
unlimited length.args
- The optional arguments to pass back to the callbacks.IOException
Copyright © 2005–2018. All rights reserved.