public class ReadableBufferedChannel extends BufferedSelectionChannel<ReadableSelectionChannel> implements ReadableSelectionChannel, CompletionListener
| Constructor and Description |
|---|
ReadableBufferedChannel(CompletionListener completionListener,
Buffer buffer,
ReadableSelectionChannel source,
WakeupListener wakeupListener)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
couldDrain(Buffer buffer,
Object... args)
Indicates if the buffer could be drained again.
|
boolean |
couldFill(Buffer buffer,
Object... args)
Indicates if the buffer could be filled again.
|
protected boolean |
isEndReached()
Indicates if the end of the channel has been reached.
|
int |
onDrain(Buffer buffer,
int maxDrained,
Object... args)
Drains the byte buffer.
|
int |
onFill(Buffer buffer,
Object... args)
Fills the byte buffer by writing the current message.
|
void |
onMessageCompleted(boolean eofDetected)
Callback invoked upon IO completion.
|
int |
read(ByteBuffer targetBuffer)
Reads some bytes and put them into the destination buffer.
|
protected void |
setEndReached(boolean endReached)
Indicates if the end of the channel has been reached.
|
canLoop, close, getBuffer, onFillEof, postProcess, preProcessgetRegistration, isBlocking, setRegistration, toStringgetWrappedChannel, isOpenclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetRegistrationisBlockingpublic ReadableBufferedChannel(CompletionListener completionListener, Buffer buffer, ReadableSelectionChannel source, WakeupListener wakeupListener)
completionListener - The listener to callback upon reading completion.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 couldDrain(Buffer buffer, Object... args)
buffer - The IO buffer to drain.args - The optional arguments to pass back to the callbacks.public boolean couldFill(Buffer buffer, Object... args)
couldFill in interface BufferProcessorbuffer - The IO buffer to fill.args - The optional arguments to pass back to the callbacks.protected boolean isEndReached()
public int onDrain(Buffer buffer, int maxDrained, Object... args) throws IOException
onDrain in interface BufferProcessorbuffer - The IO buffer to drain.maxDrained - The maximum number of bytes drained by this call.args - The optional arguments to pass back to the callbacks.IOExceptionpublic final int onFill(Buffer buffer, Object... args) throws IOException
onFill in interface BufferProcessorbuffer - The IO buffer to drain.args - The optional arguments to pass back to the callbacks.IOExceptionpublic void onMessageCompleted(boolean eofDetected)
throws IOException
CompletionListener.onMessageCompleted(boolean) if the end has
been reached.onMessageCompleted in interface CompletionListenereofDetected - Indicates if the end of network connection was detected.IOExceptionpublic int read(ByteBuffer targetBuffer) throws IOException
read in interface ReadableByteChanneltargetBuffer - The target buffer.IOExceptionprotected void setEndReached(boolean endReached)
throws IOException
endReached - True if the end of the channel has been reached.IOExceptionCopyright © 2005–2015. All rights reserved.