|
Oracle® Coherence Java API Reference Release 12.1.2.0.3 E26043-02 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
java.io.InputStream
com.tangosol.io.nio.ByteBufferInputStream
public class ByteBufferInputStream
An InputStream implementation on top of a Java NIO ByteBuffer.
Field Summary | |
---|---|
protected java.nio.ByteBuffer |
m_buf The ByteBuffer object from which data is read. |
Constructor Summary | |
---|---|
ByteBufferInputStream(java.nio.ByteBuffer buffer) Construct a ByteBufferInputStream on a ByteBuffer object. |
Method Summary | |
---|---|
int |
available() Returns the number of bytes that can be read (or skipped over) from this input stream without blocking by the next caller of a method for this input stream. |
void |
close() Close the stream, flushing any accumulated bytes. |
java.nio.ByteBuffer |
getByteBuffer() Obtain the ByteBuffer that this InputStream is based on. |
void |
mark(int readlimit) Marks the current position in this input stream. |
boolean |
markSupported() Tests if this input stream supports the mark and reset methods. |
protected java.lang.NullPointerException |
potentialStreamClosedException(java.lang.NullPointerException e) Check if an NPE is caused by the stream being closed. |
int |
read() Reads the next byte of data from the input stream. |
int |
read(byte[] abDest, int ofDest, int cbDest) Reads up to len bytes of data from the input stream into an array of bytes. |
void |
reset() Repositions this stream to the position at the time the mark method was last called on this input stream. |
long |
skip(long lcb) Skips over and discards n bytes of data from this input stream. |
Methods inherited from class java.io.InputStream |
---|
read |
Methods inherited from interface com.oracle.common.io.InputStreaming |
---|
read |
Field Detail |
---|
protected java.nio.ByteBuffer m_buf
Constructor Detail |
---|
public ByteBufferInputStream(java.nio.ByteBuffer buffer)
buffer
- the ByteBuffer to read the data fromMethod Detail |
---|
public java.nio.ByteBuffer getByteBuffer()
public int read() throws java.io.IOException
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. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown.read
in interface com.oracle.common.io.InputStreaming
read
in class java.io.InputStream
-1
if the end of the stream is reachedjava.io.IOException
- if an I/O error occurspublic int read(byte[] abDest, int ofDest, int cbDest) throws java.io.IOException
len
bytes of data from the input stream into an array of bytes. An attempt is made to read as many as len
bytes, but a smaller number may be read, possibly zero. The number of bytes actually read is returned as an integer.read
in interface com.oracle.common.io.InputStreaming
read
in class java.io.InputStream
abDest
- the buffer into which the data is readofDest
- the start offset in array b
at which the data is writtencbDest
- the maximum number of bytes to read-1
if there is no more data because the end of the stream has been reached.java.io.IOException
public long skip(long lcb) throws java.io.IOException
n
bytes of data from this input stream. The skip
method may, for a variety of reasons, end up skipping over some smaller number of bytes, possibly 0
. This may result from any of a number of conditions; reaching end of file before n
bytes have been skipped is only one possibility. The actual number of bytes skipped is returned. If n
is negative, no bytes are skipped.skip
in interface com.oracle.common.io.InputStreaming
skip
in class java.io.InputStream
lcb
- the number of bytes to be skippedjava.io.IOException
- if an I/O error occurspublic int available() throws java.io.IOException
available
in interface com.oracle.common.io.InputStreaming
available
in class java.io.InputStream
java.io.IOException
public void mark(int readlimit)
reset
method repositions this stream at the last marked position so that subsequent reads re-read the same bytes.mark
in interface com.oracle.common.io.InputStreaming
mark
in class java.io.InputStream
readlimit
- the maximum limit of bytes that can be read before the mark position becomes invalidpublic void reset() throws java.io.IOException
mark
method was last called on this input stream.reset
in interface com.oracle.common.io.InputStreaming
reset
in class java.io.InputStream
java.io.IOException
- if an I/O error occurs.public boolean markSupported()
mark
and reset
methods. The markSupported
method of InputStream
returns false
.markSupported
in interface com.oracle.common.io.InputStreaming
markSupported
in class java.io.InputStream
true
if this true type supports the mark and reset method; false
otherwisepublic void close() throws java.io.IOException
close
in interface com.oracle.common.io.InputStreaming
close
in interface java.io.Closeable
close
in class java.io.InputStream
java.io.IOException
- if an I/O error occurs.protected java.lang.NullPointerException potentialStreamClosedException(java.lang.NullPointerException e) throws java.io.IOException
e
- an NPEjava.io.IOException
- if the stream is closed
|
Oracle® Coherence Java API Reference Release 12.1.2.0.3 E26043-02 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |