|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.restlet.engine.io.WrapperChannel<T>
org.restlet.engine.io.WrapperSelectionChannel<T>
org.restlet.engine.io.BufferedSelectionChannel<ReadableSelectionChannel>
org.restlet.engine.io.ReadableBufferedChannel
public class ReadableBufferedChannel
Readable byte channel based on a source socket channel that must only be partially read. It is capable of first using the remaining buffer before reading more.
Constructor Summary | |
---|---|
ReadableBufferedChannel(CompletionListener completionListener,
Buffer buffer,
ReadableSelectionChannel source,
WakeupListener wakeupListener)
Constructor. |
Method Summary | |
---|---|
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. |
Methods inherited from class org.restlet.engine.io.BufferedSelectionChannel |
---|
canLoop, close, getBuffer, onFillEof, postProcess, preProcess |
Methods inherited from class org.restlet.engine.io.WrapperSelectionChannel |
---|
getRegistration, isBlocking, setRegistration, toString |
Methods inherited from class org.restlet.engine.io.WrapperChannel |
---|
getWrappedChannel, isOpen |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.restlet.engine.io.SelectionChannel |
---|
getRegistration |
Methods inherited from interface org.restlet.engine.io.BlockableChannel |
---|
isBlocking |
Methods inherited from interface java.nio.channels.Channel |
---|
close, isOpen |
Constructor Detail |
---|
public 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.Method Detail |
---|
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 BufferProcessor
buffer
- The IO buffer to fill.args
- The optional arguments to pass back to the callbacks.
protected boolean isEndReached()
public void onMessageCompleted(boolean eofDetected) throws IOException
CompletionListener.onMessageCompleted(boolean)
if the end has been
reached.
onMessageCompleted
in interface CompletionListener
eofDetected
- Indicates if the end of network connection was detected.
IOException
public int onDrain(Buffer buffer, int maxDrained, Object... args) throws IOException
onDrain
in interface BufferProcessor
buffer
- 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.
IOException
public final int onFill(Buffer buffer, Object... args) throws IOException
onFill
in interface BufferProcessor
buffer
- The IO buffer to drain.args
- The optional arguments to pass back to the callbacks.
IOException
public int read(ByteBuffer targetBuffer) throws IOException
read
in interface ReadableByteChannel
targetBuffer
- The target buffer.
IOException
protected void setEndReached(boolean endReached) throws IOException
endReached
- True if the end of the channel has been reached.
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |