public class ByteBufferInput extends InputStream implements ByteInput
InputStream which implements ByteInput and reads bytes from a ByteBuffer.| Constructor and Description |
|---|
ByteBufferInput(ByteBuffer buffer)
Construct a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
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() |
int |
read()
Reads the next byte of data from the input stream.
|
int |
read(byte[] b)
Read some bytes from the input stream into the given array.
|
int |
read(byte[] b,
int off,
int len)
Read some bytes from the input stream into the given array.
|
long |
skip(long n)
Skips over and discards up to
n bytes of data from this input stream. |
mark, markSupported, resetpublic ByteBufferInput(ByteBuffer buffer)
buffer - the buffer to read frompublic int read()
throws IOException
read in interface ByteInputread in class InputStreamIOException - if an error occurspublic int read(byte[] b)
throws IOException
read in interface ByteInputread in class InputStreamb - the destination arrayIOException - if an error occurspublic int read(byte[] b,
int off,
int len)
throws IOException
read in interface ByteInputread in class InputStreamb - 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 arrayIOException - if an error occurspublic int available()
throws IOException
available in interface ByteInputavailable in class InputStreamIOException - if an error occurspublic long skip(long n)
throws IOException
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 ByteInputskip in class InputStreamn - the number of bytes to attempt to skipIOException - if an error occurspublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class InputStreamIOExceptionCopyright © 2012 JBoss by Red Hat. All Rights Reserved.