Package com.esotericsoftware.kryo.io
Class ByteBufferOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- com.esotericsoftware.kryo.io.ByteBufferOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
public class ByteBufferOutputStream extends 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(ByteBuffer byteBuffer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ByteBuffergetByteBuffer()voidsetByteBuffer(ByteBuffer byteBuffer)voidwrite(byte[] bytes, int offset, int length)voidwrite(int b)-
Methods inherited from class java.io.OutputStream
close, flush, nullOutputStream, write
-
-
-
-
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(ByteBuffer byteBuffer)
-
-
Method Detail
-
getByteBuffer
public ByteBuffer getByteBuffer()
-
setByteBuffer
public void setByteBuffer(ByteBuffer byteBuffer)
-
write
public void write(int b) throws IOException- Specified by:
writein classOutputStream- Throws:
IOException
-
write
public void write(byte[] bytes, int offset, int length) throws IOException- Overrides:
writein classOutputStream- Throws:
IOException
-
-