Package com.esotericsoftware.kryo.io
Class ByteBufferOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- com.esotericsoftware.kryo.io.ByteBufferOutputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.Flushable
,java.lang.AutoCloseable
public class ByteBufferOutputStream extends java.io.OutputStream
An OutputStream whose target is aByteBuffer
. If bytes would be written that would overflow the buffer,OutputStream.flush()
is called. Subclasses can override flush to empty the buffer.- Author:
- Nathan Sweet
-
-
Constructor Summary
Constructors Constructor Description ByteBufferOutputStream()
Creates an uninitialized stream that cannot be used untilsetByteBuffer(ByteBuffer)
is called.ByteBufferOutputStream(int bufferSize)
Creates a stream with a new non-direct buffer of the specified size.ByteBufferOutputStream(java.nio.ByteBuffer byteBuffer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.nio.ByteBuffer
getByteBuffer()
void
setByteBuffer(java.nio.ByteBuffer byteBuffer)
void
write(byte[] bytes, int offset, int length)
void
write(int b)
-
-
-
Constructor Detail
-
ByteBufferOutputStream
public ByteBufferOutputStream()
Creates an uninitialized stream that cannot be used untilsetByteBuffer(ByteBuffer)
is called.
-
ByteBufferOutputStream
public ByteBufferOutputStream(int bufferSize)
Creates a stream with a new non-direct buffer of the specified size.
-
ByteBufferOutputStream
public ByteBufferOutputStream(java.nio.ByteBuffer byteBuffer)
-
-
Method Detail
-
getByteBuffer
public java.nio.ByteBuffer getByteBuffer()
-
setByteBuffer
public void setByteBuffer(java.nio.ByteBuffer byteBuffer)
-
write
public void write(int b) throws java.io.IOException
- Specified by:
write
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
write
public void write(byte[] bytes, int offset, int length) throws java.io.IOException
- Overrides:
write
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
-