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.InputStream
Joins 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 void
add(java.util.List<java.nio.ByteBuffer> additionalBuffers)
Adds additional byte buffers to this instance in a thread-safe manner.int
read()
Reads the next byte from the buffer.void
reset()
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.IOException
Reads the next byte from the buffer.- Specified by:
read
in 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:
reset
in classjava.io.InputStream
-
-