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
public class ByteBufferOutputStream
- extends java.io.OutputStream
An OutputStream whose target is a ByteBuffer
. If bytes would be written that would overflow the buffer,
OutputStream.flush()
is called. Subclasses can override flush to empty the buffer.
Methods inherited from class java.io.OutputStream |
close, flush, write |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ByteBufferOutputStream
public ByteBufferOutputStream()
- Creates an uninitialized stream that cannot be used until
setByteBuffer(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)
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 class java.io.OutputStream
- Throws:
java.io.IOException
write
public void write(byte[] bytes,
int offset,
int length)
throws java.io.IOException
- Overrides:
write
in class java.io.OutputStream
- Throws:
java.io.IOException