Package com.esotericsoftware.kryo.io
Class ByteBufferInputStream
- java.lang.Object
-
- java.io.InputStream
-
- com.esotericsoftware.kryo.io.ByteBufferInputStream
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class ByteBufferInputStream extends InputStream
An InputStream whose source is aByteBuffer
.- Author:
- Nathan Sweet
-
-
Constructor Summary
Constructors Constructor Description ByteBufferInputStream()
Creates an uninitialized stream that cannot be used untilsetByteBuffer(ByteBuffer)
is called.ByteBufferInputStream(int bufferSize)
Creates a stream with a new non-direct buffer of the specified size.ByteBufferInputStream(ByteBuffer byteBuffer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
available()
ByteBuffer
getByteBuffer()
int
read()
int
read(byte[] bytes, int offset, int length)
void
setByteBuffer(ByteBuffer byteBuffer)
-
Methods inherited from class java.io.InputStream
close, mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
-
-
-
-
Constructor Detail
-
ByteBufferInputStream
public ByteBufferInputStream()
Creates an uninitialized stream that cannot be used untilsetByteBuffer(ByteBuffer)
is called.
-
ByteBufferInputStream
public ByteBufferInputStream(int bufferSize)
Creates a stream with a new non-direct buffer of the specified size. The position and limit of the buffer is zero.
-
ByteBufferInputStream
public ByteBufferInputStream(ByteBuffer byteBuffer)
-
-
Method Detail
-
getByteBuffer
public ByteBuffer getByteBuffer()
-
setByteBuffer
public void setByteBuffer(ByteBuffer byteBuffer)
-
read
public int read() throws IOException
- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
public int read(byte[] bytes, int offset, int length) throws IOException
- Overrides:
read
in classInputStream
- Throws:
IOException
-
available
public int available() throws IOException
- Overrides:
available
in classInputStream
- Throws:
IOException
-
-