public class DirectBufferOutputStream extends OutputStream
OutputStream
that wraps an underlying MutableDirectBuffer
.Constructor and Description |
---|
DirectBufferOutputStream()
Default constructor.
|
DirectBufferOutputStream(MutableDirectBuffer buffer)
Constructs output stream wrapping the given buffer.
|
DirectBufferOutputStream(MutableDirectBuffer buffer,
int offset,
int length)
Constructs output stream wrapping the given buffer at an offset.
|
Modifier and Type | Method and Description |
---|---|
MutableDirectBuffer |
buffer()
The underlying buffer being wrapped.
|
void |
close()
Override to remove
IOException . |
void |
flush()
Override to remove
IOException . |
int |
length()
The length of the underlying buffer to use
|
int |
offset()
The offset within the underlying buffer at which to start.
|
int |
position()
The position in the buffer from the offset up to which has been written.
|
void |
wrap(MutableDirectBuffer buffer)
Wrap the buffer.
|
void |
wrap(MutableDirectBuffer buffer,
int offset,
int length)
Wrap the buffer at an offset.
|
void |
write(byte[] srcBytes)
Write a byte[] to the buffer.
|
void |
write(byte[] srcBytes,
int srcOffset,
int length)
Write a byte[] to the buffer.
|
void |
write(int b)
Write a byte to buffer.
|
public DirectBufferOutputStream()
public DirectBufferOutputStream(MutableDirectBuffer buffer)
buffer
- to wrap.public DirectBufferOutputStream(MutableDirectBuffer buffer, int offset, int length)
buffer
- to wrap.offset
- in the buffer.length
- size in bytes to wrap.public void wrap(MutableDirectBuffer buffer)
buffer
- to wrap.public void wrap(MutableDirectBuffer buffer, int offset, int length)
buffer
- to wrap.offset
- in the buffer.length
- size in bytes to wrap.public int position()
public int offset()
public MutableDirectBuffer buffer()
public int length()
public void write(int b)
write
in class OutputStream
b
- to be written.IllegalStateException
- if insufficient capacity remains in the buffer.public void write(byte[] srcBytes, int srcOffset, int length)
write
in class OutputStream
srcBytes
- to writesrcOffset
- at which to begin reading bytes from the srcBytes.length
- of the srcBytes to read.IllegalStateException
- if insufficient capacity remains in the buffer.public void write(byte[] srcBytes)
write
in class OutputStream
srcBytes
- to writeIllegalStateException
- if insufficient capacity remains in the buffer.public void flush()
IOException
. This method does nothing.flush
in interface Flushable
flush
in class OutputStream
public void close()
IOException
. This method does nothing.close
in interface Closeable
close
in interface AutoCloseable
close
in class OutputStream
Copyright © 2014-2021 Real Logic Limited. All Rights Reserved.