|
JBoss Marshalling 1.3.0.CR9 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
org.jboss.marshalling.NioByteInput
public class NioByteInput
A ByteInput
implementation which is populated asynchronously with ByteBuffer
instances.
Nested Class Summary | |
---|---|
static interface |
NioByteInput.BufferReturn
A handler for returning buffers which are have been exhausted. |
static interface |
NioByteInput.InputHandler
A handler for events relating to the consumption of data from a NioByteInput instance. |
Constructor Summary | |
---|---|
NioByteInput(NioByteInput.InputHandler inputHandler)
Construct a new instance. |
Method Summary | |
---|---|
int |
available()
Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking by the next invocation of a method for this input stream. |
void |
close()
|
void |
push(ByteBuffer buffer)
Push a buffer into the queue. |
void |
push(ByteBuffer buffer,
NioByteInput.BufferReturn bufferReturn)
Push a buffer into the queue. |
void |
pushEof()
Push the EOF condition into the queue. |
void |
pushException(IOException e)
Push an exception condition into the queue. |
int |
read()
Reads the next byte of data from the input stream. |
int |
read(byte[] b,
int off,
int len)
Read some bytes from the input stream into the given array. |
long |
skip(long qty)
Skips over and discards up to n bytes of data from this input stream. |
Methods inherited from class java.io.InputStream |
---|
mark, markSupported, read, reset |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.jboss.marshalling.ByteInput |
---|
read |
Constructor Detail |
---|
public NioByteInput(NioByteInput.InputHandler inputHandler)
inputHandler
will
be invoked after each buffer is fully read and when the stream is closed.
inputHandler
- the input events handlerMethod Detail |
---|
public void push(ByteBuffer buffer)
Semaphore
.
buffer
- the buffer from which more data should be readpublic void push(ByteBuffer buffer, NioByteInput.BufferReturn bufferReturn)
Semaphore
.
buffer
- the buffer from which more data should be readbufferReturn
- the buffer return to send this buffer to when it is exhaustedpublic void pushEof()
public void pushException(IOException e)
e
- the exception to pushpublic int read() throws IOException
read
in interface ByteInput
read
in class InputStream
IOException
- if an error occurspublic int read(byte[] b, int off, int len) throws IOException
read
in interface ByteInput
read
in class InputStream
b
- the destination arrayoff
- the offset into the array into which data should be readlen
- the number of bytes to attempt to fill in the destination array
IOException
- if an error occurspublic int available() throws IOException
available
in interface ByteInput
available
in class InputStream
IOException
- if an error occurspublic long skip(long qty) throws IOException
ByteInput
n
bytes of data from this input stream. If the end of stream is reached,
this method returns 0
in order to be consistent with InputStream.skip(long)
.
skip
in interface ByteInput
skip
in class InputStream
qty
- the number of bytes to attempt to skip
IOException
- if an error occurspublic void close() throws IOException
close
in interface Closeable
close
in class InputStream
IOException
|
JBoss Marshalling 1.3.0.CR9 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |