Constructor and Description |
---|
ByteBufferInput(java.nio.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. |
public ByteBufferInput(java.nio.ByteBuffer buffer)
buffer
- the buffer to read frompublic int read() throws java.io.IOException
public int read(byte[] b) throws java.io.IOException
public int read(byte[] b, int off, int len) throws java.io.IOException
read
in interface ByteInput
read
in class java.io.InputStream
b
- 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 arrayjava.io.IOException
- if an error occurspublic int available() throws java.io.IOException
public long skip(long n) throws java.io.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)
.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 © 2011 JBoss, a division of Red Hat, Inc.