com.bigdata.io
Class ByteBufferInputStream
java.lang.Object
java.io.InputStream
com.bigdata.io.ByteBufferInputStream
- All Implemented Interfaces:
- Closeable
public class ByteBufferInputStream
- extends InputStream
Reads bytes from a ByteBuffer. This class IS NOT thread-safe.
Caller's MUST ByteBuffer.duplicate() the ByteBuffer before
creating an instance of this class if they wish to avoid side-effects on the
position and limit of the original ByteBuffer.
- Version:
- $Id: ByteBufferInputStream.java 2265 2009-10-26 12:51:06Z thompsonbry $
- Author:
- Bryan Thompson
- TODO:
- document that this reads the remaining() bytes and has a side effect on
the position. if that is not the desired behavior then either modify
this class or invoke
ByteBuffer.asReadOnlyBuffer() and pass the
result into the constructor instead., dsiutils now defines its own implementation of this but does not define
a ByteBufferOutputStream class. if it did, then we might just use its
implementations instead.
|
Method Summary |
int |
read()
Read the next byte from the buffer. |
int |
read(byte[] a,
int off,
int len)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ByteBufferInputStream
public ByteBufferInputStream(ByteBuffer buf)
read
public int read()
throws IOException
- Read the next byte from the buffer.
- Specified by:
read in class InputStream
- Returns:
- The byte as a value in [0:255].
- Throws:
IOException
read
public int read(byte[] a,
int off,
int len)
throws IOException
- Overrides:
read in class InputStream
- Throws:
IOException
Copyright © 2006-2012 SYSTAP, LLC. All Rights Reserved.