public class ChannelInputStream extends InputStream implements BufferProcessor
| Constructor and Description |
|---|
ChannelInputStream(ReadableByteChannel channel)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
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) |
available, close, mark, markSupported, read, reset, skippublic ChannelInputStream(ReadableByteChannel channel)
channel - The channel to read from.public boolean canLoop(Buffer buffer, Object... args)
canLoop in interface BufferProcessorbuffer - 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 Buffer getBuffer()
public int onDrain(Buffer buffer, int maxDrained, Object... args) throws IOException
InputStream bytes.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 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 onFillEof()
onFillEof in interface BufferProcessorpublic void postProcess(int drained)
throws IOException
postProcess in interface BufferProcessordrained - The number of bytes drained or -1 if the filling source has
ended.IOExceptionpublic int preProcess(int maxDrained,
Object... args)
throws IOException
preProcess in interface BufferProcessormaxDrained - The maximum number of bytes drained by this call or 0 for
unlimited length.args - The optional arguments to pass back to the callbacks.IOExceptionpublic int read()
throws IOException
read in class InputStreamIOExceptionpublic int read(byte[] targetArray,
int offset,
int length)
throws IOException
read in class InputStreamIOExceptionCopyright © 2005–2015. All rights reserved.