public class ByteBufferOutputStream
extends java.io.OutputStream
ByteBuffer
. If bytes would be written that would overflow the buffer,
OutputStream.flush()
is called. Subclasses can override flush to empty the buffer.Constructor and Description |
---|
ByteBufferOutputStream()
Creates an uninitialized stream that cannot be used until
setByteBuffer(ByteBuffer) is called. |
ByteBufferOutputStream(java.nio.ByteBuffer byteBuffer) |
ByteBufferOutputStream(int bufferSize)
Creates a stream with a new non-direct buffer of the specified size.
|
Modifier and Type | Method and Description |
---|---|
java.nio.ByteBuffer |
getByteBuffer() |
void |
setByteBuffer(java.nio.ByteBuffer byteBuffer) |
void |
write(byte[] bytes,
int offset,
int length) |
void |
write(int b) |
public ByteBufferOutputStream()
setByteBuffer(ByteBuffer)
is called.public ByteBufferOutputStream(int bufferSize)
public ByteBufferOutputStream(java.nio.ByteBuffer byteBuffer)
public java.nio.ByteBuffer getByteBuffer()
public void setByteBuffer(java.nio.ByteBuffer byteBuffer)
public void write(int b) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void write(byte[] bytes, int offset, int length) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException