voldemort.utils
Class ByteBufferBackedInputStream
java.lang.Object
java.io.InputStream
voldemort.utils.ByteBufferBackedInputStream
- All Implemented Interfaces:
- java.io.Closeable
public class ByteBufferBackedInputStream
- extends java.io.InputStream
ByteBufferBackedInputStream allows a ByteBuffer to be the source of data for
InputStream-based callers.
This class is used to interface with callers using "classic" java.io.* APIs.
For code that manages the ByteBufferBackedInputStream, there are accessor
methods for the underlying buffer should it need to expand and contract on
reuse.
|
Method Summary |
java.nio.ByteBuffer |
getBuffer()
|
int |
read()
|
int |
read(byte[] bytes,
int off,
int len)
|
void |
setBuffer(java.nio.ByteBuffer buffer)
|
| Methods inherited from class java.io.InputStream |
available, close, mark, markSupported, read, reset, skip |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ByteBufferBackedInputStream
public ByteBufferBackedInputStream(java.nio.ByteBuffer buffer)
getBuffer
public java.nio.ByteBuffer getBuffer()
setBuffer
public void setBuffer(java.nio.ByteBuffer buffer)
read
public int read()
throws java.io.IOException
- Specified by:
read in class java.io.InputStream
- Throws:
java.io.IOException
read
public int read(byte[] bytes,
int off,
int len)
throws java.io.IOException
- Overrides:
read in class java.io.InputStream
- Throws:
java.io.IOException
Jay Kreps, Roshan Sumbaly, Alex Feinberg, Bhupesh Bansal, Lei Gao