|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
org.restlet.engine.io.NbChannelInputStream
public class NbChannelInputStream
Input stream connected to a non-blocking readable channel.
Constructor Summary | |
---|---|
NbChannelInputStream(ReadableByteChannel channel)
Constructor. |
Method Summary | |
---|---|
boolean |
canLoop(Buffer buffer,
Object... args)
Indicates if the processing loop can continue. |
boolean |
couldFill(Buffer buffer,
Object... args)
Indicates if the buffer could be filled again. |
protected Buffer |
getBuffer()
Returns the internal byte buffer. |
int |
onDrain(Buffer buffer,
int maxDrained,
Object... args)
Drains the byte buffer by returning available bytes as InputStream bytes. |
int |
onFill(Buffer buffer,
Object... args)
Fills the byte buffer by reading the source channel. |
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. |
int |
read()
|
int |
read(byte[] targetArray,
int offset,
int length)
|
Methods inherited from class java.io.InputStream |
---|
available, close, mark, markSupported, read, reset, skip |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NbChannelInputStream(ReadableByteChannel channel)
channel
- The channel to read from.Method Detail |
---|
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 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 Buffer getBuffer()
public int onDrain(Buffer buffer, int maxDrained, Object... args) throws IOException
InputStream
bytes.
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 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 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
public int read() throws IOException
read
in class InputStream
IOException
public int read(byte[] targetArray, int offset, int length) throws IOException
read
in class InputStream
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |