Package org.apache.nemo.common
Class ByteBufferInputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.apache.nemo.common.ByteBufferInputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public final class ByteBufferInputStream extends java.io.InputStream
This class is a customized input stream implementation which reads data from list ofByteBuffer
. If theByteBuffer
is direct, it may reside outside the normal garbage-collected heap memory.
-
-
Constructor Summary
Constructors Constructor Description ByteBufferInputStream(java.util.List<java.nio.ByteBuffer> bufList)
Default Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.nio.ByteBuffer
getBuffer()
Return next non-empty @code{ByteBuffer}.int
read()
Reads data from the list ofByteBuffer
s.
-
-
-
Method Detail
-
read
public int read() throws java.io.IOException
Reads data from the list ofByteBuffer
s.- Specified by:
read
in classjava.io.InputStream
- Returns:
- integer.
- Throws:
java.io.IOException
- exception.
-
getBuffer
public java.nio.ByteBuffer getBuffer() throws java.io.IOException
Return next non-empty @code{ByteBuffer}.- Returns:
ByteBuffer
to write the data.- Throws:
java.io.IOException
- when fail to retrieve buffer.
-
-