@InterfaceAudience.Private public class ByteBufferInputStream extends InputStream
Please note that the reads will cause position movement on wrapped ByteBuffer.
| Modifier and Type | Field and Description |
|---|---|
private ByteBuffer |
buf |
| Constructor and Description |
|---|
ByteBufferInputStream(ByteBuffer buf) |
| Modifier and Type | Method and Description |
|---|---|
int |
available() |
int |
read()
Reads the next byte of data from this input stream.
|
int |
read(byte[] b,
int off,
int len)
Reads up to next
len bytes of data from buffer into passed array(starting from
given offset). |
long |
skip(long n)
Skips
n bytes of input from this input stream. |
close, mark, markSupported, read, resetprivate ByteBuffer buf
public ByteBufferInputStream(ByteBuffer buf)
public int read()
int in the range 0 to 255. If no byte is available
because the end of the stream has been reached, the value -1 is returned.read in class InputStream-1 if the end of the stream has been reached.public int read(byte[] b, int off, int len)
len bytes of data from buffer into passed array(starting from
given offset).read in class InputStreamb - the array into which the data is read.off - the start offset in the destination array blen - the maximum number of bytes to read.-1 if not even
1 byte can be read because the end of the stream has been reached.public long skip(long n)
n bytes of input from this input stream. Fewer bytes might be skipped if the
end of the input stream is reached. The actual number k of bytes to be skipped is
equal to the smaller of n and remaining bytes in the stream.skip in class InputStreamn - the number of bytes to be skipped.public int available()
available in class InputStreamCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.