public class ByteBufferQueueInputStream extends InputStream
InputStream
backed by a ByteBufferQueue
. Assumes that the backing ByteBufferQueue
will
not be updated by another thread during calls to read()
so all methods are non-blocking and an empty
ByteBufferQueue
is deemed equivalent to end of stream.Constructor and Description |
---|
ByteBufferQueueInputStream(ByteBufferQueue queue)
Constructs a new instance.
|
ByteBufferQueueInputStream(ByteBufferQueue queue,
int length)
Constructs a new instance.
|
Modifier and Type | Method and Description |
---|---|
int |
available() |
void |
mark(int readlimit) |
boolean |
markSupported() |
int |
read() |
int |
read(byte[] b,
int off,
int len) |
void |
reset() |
long |
skip(long n) |
close, read
public ByteBufferQueueInputStream(ByteBufferQueue queue)
queue
- the backing ByteBufferQueue
.public ByteBufferQueueInputStream(ByteBufferQueue queue, int length)
queue
- the backing ByteBufferQueue
.length
- the limit of bytes to take from the backing queue.public int read() throws IOException
read
in class InputStream
IOException
public int read(@NonNull byte[] b, int off, int len) throws IOException
read
in class InputStream
IOException
public long skip(long n) throws IOException
skip
in class InputStream
IOException
public int available() throws IOException
available
in class InputStream
IOException
public void mark(int readlimit)
mark
in class InputStream
public void reset() throws IOException
reset
in class InputStream
IOException
public boolean markSupported()
markSupported
in class InputStream
Copyright © 2004–2022. All rights reserved.