Class ChannelInputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.restlet.ext.nio.internal.channel.ChannelInputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,BufferProcessor
@Deprecated public class ChannelInputStream extends java.io.InputStream implements BufferProcessor
Deprecated.Will be removed to favor lower-level network extensions allowing more control at the Restlet API level.Input stream connected to a non-blocking readable channel.
-
-
Field Summary
Fields Modifier and Type Field Description private BufferbufferDeprecated.The internal byte buffer.private java.nio.channels.ReadableByteChannelchannelDeprecated.The channel to read from.private booleanendReachedDeprecated.Indicates if further reads can be attempted.private java.nio.channels.SelectableChannelselectableChannelDeprecated.The optional selectable channel to read from.private SelectionChannelselectionChannelDeprecated.The optional selection channel to read from.private SelectionRegistrationselectionRegistrationDeprecated.The registered selection registration.
-
Constructor Summary
Constructors Constructor Description ChannelInputStream(java.nio.channels.ReadableByteChannel channel)Deprecated.Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleancanLoop(Buffer buffer, java.lang.Object... args)Deprecated.Indicates if the processing loop can continue.booleancouldFill(Buffer buffer, java.lang.Object... args)Deprecated.Indicates if the buffer could be filled again.protected BuffergetBuffer()Deprecated.Returns the internal byte buffer.intonDrain(Buffer buffer, int maxDrained, java.lang.Object... args)Deprecated.Drains the byte buffer by returning available bytes asInputStreambytes.intonFill(Buffer buffer, java.lang.Object... args)Deprecated.Fills the byte buffer by reading the source channel.voidonFillEof()Deprecated.Called back when a fill operation returns with an EOF status.voidpostProcess(int drained)Deprecated.Does nothing by default.intpreProcess(int maxDrained, java.lang.Object... args)Deprecated.Does nothing by default.intread()Deprecated.intread(byte[] targetArray, int offset, int length)Deprecated.
-
-
-
Field Detail
-
buffer
private final Buffer buffer
Deprecated.The internal byte buffer.
-
channel
private final java.nio.channels.ReadableByteChannel channel
Deprecated.The channel to read from.
-
endReached
private volatile boolean endReached
Deprecated.Indicates if further reads can be attempted.
-
selectableChannel
private final java.nio.channels.SelectableChannel selectableChannel
Deprecated.The optional selectable channel to read from.
-
selectionChannel
private final SelectionChannel selectionChannel
Deprecated.The optional selection channel to read from.
-
selectionRegistration
private volatile SelectionRegistration selectionRegistration
Deprecated.The registered selection registration.
-
-
Method Detail
-
canLoop
public boolean canLoop(Buffer buffer, java.lang.Object... args)
Deprecated.Indicates if the processing loop can continue.- Specified by:
canLoopin interfaceBufferProcessor- Parameters:
buffer- The IO buffer to drain.args- The optional arguments to pass back to the callbacks.- Returns:
- True if the processing loop can continue.
-
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.
-
getBuffer
protected Buffer getBuffer()
Deprecated.Returns the internal byte buffer.- Returns:
- The internal byte buffer.
-
onDrain
public int onDrain(Buffer buffer, int maxDrained, java.lang.Object... args) throws java.io.IOException
Deprecated.Drains the byte buffer by returning available bytes asInputStreambytes.- 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 int onFill(Buffer buffer, java.lang.Object... args) throws java.io.IOException
Deprecated.Fills the byte buffer by reading the source channel.- 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
-
onFillEof
public void onFillEof()
Deprecated.Called back when a fill operation returns with an EOF status.- Specified by:
onFillEofin interfaceBufferProcessor
-
postProcess
public void postProcess(int drained) throws java.io.IOExceptionDeprecated.Does nothing by default.- Specified by:
postProcessin interfaceBufferProcessor- Parameters:
drained- The number of bytes drained or -1 if the filling source has ended.- Throws:
java.io.IOException
-
preProcess
public int preProcess(int maxDrained, java.lang.Object... args) throws java.io.IOExceptionDeprecated.Does nothing by default.- Specified by:
preProcessin interfaceBufferProcessor- Parameters:
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.- Returns:
- The number of bytes drained or -1 if the filling source has ended.
- Throws:
java.io.IOException
-
read
public int read() throws java.io.IOExceptionDeprecated.- Specified by:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
read
public int read(byte[] targetArray, int offset, int length) throws java.io.IOExceptionDeprecated.- Overrides:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
-