public class BufferPipeInputStream
extends java.io.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(java.nio.ByteBuffer buffer)
Push a buffer into the queue.
|
void |
push(Pooled<java.nio.ByteBuffer> pooledBuffer)
Push a buffer into the queue.
|
void |
pushEof()
Push the EOF condition into the queue.
|
void |
pushException(java.io.IOException e)
Push an exception condition into the queue.
|
int |
read() |
int |
read(byte[] b,
int off,
int len) |
long |
skip(long qty) |
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(java.nio.ByteBuffer buffer)
Semaphore
.buffer
- the buffer from which more data should be readpublic void push(Pooled<java.nio.ByteBuffer> pooledBuffer)
Semaphore
.pooledBuffer
- the buffer from which more data should be readpublic void pushException(java.io.IOException e)
e
- the exception to pushpublic void pushEof()
public int read() throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public int read(byte[] b, int off, int len) throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public int available() throws java.io.IOException
available
in class java.io.InputStream
java.io.IOException
public long skip(long qty) throws java.io.IOException
skip
in class java.io.InputStream
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.InputStream
java.io.IOException
Copyright © 2016 JBoss, a division of Red Hat, Inc.