Class ReadableBufferedChannel
- java.lang.Object
-
- org.restlet.ext.nio.internal.channel.WrapperChannel<T>
-
- org.restlet.ext.nio.internal.channel.WrapperSelectionChannel<T>
-
- org.restlet.ext.nio.internal.channel.BufferedSelectionChannel<ReadableSelectionChannel>
-
- org.restlet.ext.nio.internal.channel.ReadableBufferedChannel
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,java.nio.channels.Channel,java.nio.channels.ReadableByteChannel,BlockableChannel,ReadableSelectionChannel,SelectionChannel,BufferProcessor,CompletionListener
- Direct Known Subclasses:
ReadableChunkedChannel,ReadableSizedSelectionChannel,ReadableSslChannel
@Deprecated public class ReadableBufferedChannel extends BufferedSelectionChannel<ReadableSelectionChannel> implements ReadableSelectionChannel, CompletionListener
Deprecated.Will be removed to favor lower-level network extensions allowing more control at the Restlet API level.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.
-
-
Field Summary
Fields Modifier and Type Field Description private CompletionListenercompletionListenerDeprecated.The completion callback.private booleanendReachedDeprecated.Indicates if the end of the channel has been reached.
-
Constructor Summary
Constructors Constructor Description ReadableBufferedChannel(CompletionListener completionListener, Buffer buffer, ReadableSelectionChannel source, WakeupListener wakeupListener)Deprecated.Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleancouldDrain(Buffer buffer, java.lang.Object... args)Deprecated.Indicates if the buffer could be drained again.booleancouldFill(Buffer buffer, java.lang.Object... args)Deprecated.Indicates if the buffer could be filled again.private CompletionListenergetCompletionListener()Deprecated.Returns the completion callback.protected booleanisEndReached()Deprecated.Indicates if the end of the channel has been reached.intonDrain(Buffer buffer, int maxDrained, java.lang.Object... args)Deprecated.Drains the byte buffer.intonFill(Buffer buffer, java.lang.Object... args)Deprecated.Fills the byte buffer by writing the current message.voidonMessageCompleted(boolean eofDetected)Deprecated.Callback invoked upon IO completion.intread(java.nio.ByteBuffer targetBuffer)Deprecated.Reads some bytes and put them into the destination buffer.protected voidsetEndReached(boolean endReached)Deprecated.Indicates if the end of the channel has been reached.-
Methods inherited from class org.restlet.ext.nio.internal.channel.BufferedSelectionChannel
canLoop, close, getBuffer, onFillEof, postProcess, preProcess
-
Methods inherited from class org.restlet.ext.nio.internal.channel.WrapperSelectionChannel
getRegistration, isBlocking, setRegistration, toString
-
Methods inherited from class org.restlet.ext.nio.internal.channel.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.BlockableChannel
isBlocking
-
Methods inherited from interface org.restlet.engine.io.SelectionChannel
getRegistration
-
-
-
-
Field Detail
-
completionListener
private final CompletionListener completionListener
Deprecated.The completion callback.
-
endReached
private volatile boolean endReached
Deprecated.Indicates if the end of the channel has been reached.
-
-
Constructor Detail
-
ReadableBufferedChannel
public ReadableBufferedChannel(CompletionListener completionListener, Buffer buffer, ReadableSelectionChannel source, WakeupListener wakeupListener)
Deprecated.Constructor.- Parameters:
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
-
couldDrain
public boolean couldDrain(Buffer buffer, java.lang.Object... args)
Deprecated.Indicates if the buffer could be drained again.- Parameters:
buffer- The IO buffer to drain.args- The optional arguments to pass back to the callbacks.- Returns:
- True if the buffer could be drained again.
-
couldFill
public boolean couldFill(Buffer buffer, java.lang.Object... args)
Deprecated.Indicates if the buffer could be filled again.- Specified by:
couldFillin interfaceBufferProcessor- Parameters:
buffer- The IO buffer to fill.args- The optional arguments to pass back to the callbacks.- Returns:
- True if the buffer could be filled again.
-
getCompletionListener
private CompletionListener getCompletionListener()
Deprecated.Returns the completion callback.- Returns:
- The completion callback.
-
isEndReached
protected boolean isEndReached()
Deprecated.Indicates if the end of the channel has been reached.- Returns:
- True if the end of the channel has been reached.
-
onDrain
public int onDrain(Buffer buffer, int maxDrained, java.lang.Object... args) throws java.io.IOException
Deprecated.Drains the byte buffer.- Specified by:
onDrainin interfaceBufferProcessor- Parameters:
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.- Returns:
- The number of bytes drained.
- Throws:
java.io.IOException
-
onFill
public final int onFill(Buffer buffer, java.lang.Object... args) throws java.io.IOException
Deprecated.Fills the byte buffer by writing the current message.- Specified by:
onFillin interfaceBufferProcessor- Parameters:
buffer- The IO buffer to drain.args- The optional arguments to pass back to the callbacks.- Returns:
- The number of bytes filled.
- Throws:
java.io.IOException
-
onMessageCompleted
public void onMessageCompleted(boolean eofDetected) throws java.io.IOExceptionDeprecated.Callback invoked upon IO completion. CallsCompletionListener.onMessageCompleted(boolean)if the end has been reached.- Specified by:
onMessageCompletedin interfaceCompletionListener- Parameters:
eofDetected- Indicates if the end of network connection was detected.- Throws:
java.io.IOException
-
read
public int read(java.nio.ByteBuffer targetBuffer) throws java.io.IOExceptionDeprecated.Reads some bytes and put them into the destination buffer. The bytes come from the underlying channel.- Specified by:
readin interfacejava.nio.channels.ReadableByteChannel- Parameters:
targetBuffer- The target buffer.- Returns:
- The number of bytes read, or -1 if the end of the channel has been reached.
- Throws:
java.io.IOException
-
setEndReached
protected void setEndReached(boolean endReached) throws java.io.IOExceptionDeprecated.Indicates if the end of the channel has been reached.- Parameters:
endReached- True if the end of the channel has been reached.- Throws:
java.io.IOException
-
-