Package com.fauna.response
Class MultiByteBufferInputStream
- java.lang.Object
-
- java.io.InputStream
-
- com.fauna.response.MultiByteBufferInputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class MultiByteBufferInputStream extends java.io.InputStreamJoins a list of byte buffers to make them appear as a single input stream.The reset method is supported, and always resets to restart the stream at the beginning of the first buffer, although markSupported() returns false for this class.
-
-
Constructor Summary
Constructors Constructor Description MultiByteBufferInputStream(java.util.List<java.nio.ByteBuffer> initialBuffers)Initializes a MultiByteBufferInputStream using the provided byte buffers.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(java.util.List<java.nio.ByteBuffer> additionalBuffers)Adds additional byte buffers to this instance in a thread-safe manner.intread()Reads the next byte from the buffer.voidreset()Resets the byte buffer.
-
-
-
Method Detail
-
add
public void add(java.util.List<java.nio.ByteBuffer> additionalBuffers)
Adds additional byte buffers to this instance in a thread-safe manner.- Parameters:
additionalBuffers- The additional ByteBuffers.
-
read
public int read() throws java.io.IOExceptionReads the next byte from the buffer.- Specified by:
readin classjava.io.InputStream- Returns:
- The next byte.
- Throws:
java.io.IOException- Thrown when the byte buffers are exhausted.
-
reset
public void reset()
Resets the byte buffer.- Overrides:
resetin classjava.io.InputStream
-
-