public class BufferPipeInputStream extends InputStream
InputStream
implementation which is populated asynchronously with ByteBuffer
instances.Modifier and Type | Class and Description |
---|---|
static interface |
BufferPipeInputStream.InputHandler
A handler for events relating to the consumption of data from a
BufferPipeInputStream instance. |
Constructor and Description |
---|
BufferPipeInputStream(BufferPipeInputStream.InputHandler inputHandler)
Construct a new instance.
|
Modifier and Type | Method and Description |
---|---|
int |
available() |
void |
close() |
void |
push(ByteBuffer buffer)
Push a buffer into the queue.
|
void |
push(Pooled<ByteBuffer> pooledBuffer)
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() |
int |
read(byte[] b,
int off,
int len) |
long |
skip(long qty) |
mark, markSupported, read, reset
public BufferPipeInputStream(BufferPipeInputStream.InputHandler inputHandler)
inputHandler
will
be invoked after each buffer is fully read and when the stream is closed.inputHandler
- the input events handlerpublic void push(ByteBuffer buffer)
Semaphore
.buffer
- the buffer from which more data should be readpublic void push(Pooled<ByteBuffer> pooledBuffer)
Semaphore
.pooledBuffer
- the buffer from which more data should be readpublic void pushException(IOException e)
e
- the exception to pushpublic void pushEof()
public int read() throws IOException
read
in class InputStream
IOException
public int read(byte[] b, int off, int len) throws IOException
read
in class InputStream
IOException
public int available() throws IOException
available
in class InputStream
IOException
public long skip(long qty) throws IOException
skip
in class InputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class InputStream
IOException
Copyright © 2018 JBoss by Red Hat. All rights reserved.