public interface StreamingDataOutput<S extends StreamingDataOutput<S>> extends StreamingCommon<S>
RandomCommon.writePosition() by
the number of bytes written. Implementations may throw
BufferOverflowException if insufficient space is available.| Modifier and Type | Field and Description |
|---|---|
static int |
JAVA9_STRING_CODER_LATIN |
static int |
JAVA9_STRING_CODER_UTF16 |
| Modifier and Type | Method and Description |
|---|---|
default S |
appendUtf8(byte[] bytes,
int offset,
int length)
Appends a UTF-8 encoded byte array to this output stream, taking into account the provided offset and length.
|
default S |
appendUtf8(byte[] bytes,
int offset,
int length,
byte coder)
Appends a UTF-8 encoded byte array to this output stream, taking into account the provided offset, length, and coder.
|
default S |
appendUtf8(char[] chars,
int offset,
int length)
Appends a UTF-8 encoded CharSequence to this output stream from a specific offset and length.
|
default S |
appendUtf8(@NotNull CharSequence cs)
Appends a UTF-8 encoded CharSequence to this output stream.
|
default S |
appendUtf8(@NotNull CharSequence cs,
int offset,
int length)
Appends a UTF-8 encoded CharSequence to this output stream from a specific offset and length.
|
default S |
appendUtf8(int codepoint)
Appends a UTF-8 encoded character to this output stream.
|
default boolean |
canWriteDirect(long count)
Determines if the buffer can write the specified count of bytes directly.
|
default void |
copyFrom(@NotNull InputStream input)
Copies data from the provided InputStream into this Bytes object.
|
void |
ensureCapacity(long desiredCapacity)
Ensures that the buffer has the desired capacity.
|
default @NotNull OutputStream |
outputStream()
Provides a view of this Bytes object as an OutputStream.
|
default S |
rawWriteByte(byte i8)
Writes a byte to the data stream without any additional checks or transformations.
|
default S |
rawWriteInt(int i)
Writes an integer to the data stream without any additional checks or transformations.
|
default S |
rawWriteLong(long i)
Writes a long integer to the data stream without performing a bounds check.
|
long |
realCapacity()
Returns the actual capacity of the buffer without resize.
|
default S |
unsafeWrite(long address,
int length)
Writes raw native memory to this output stream.
|
default S |
unsafeWriteObject(Object o,
int offset,
int length)
Writes the memory content of an object to this output stream from a specific offset.
|
default S |
write(byte[] byteArray)
Writes all the bytes from the given
byteArray into the output stream. |
S |
write(byte[] byteArray,
int offset,
int length)
Writes the specified number of bytes from the given
byteArray into the output stream, starting from the
given offset. |
default S |
write(@NotNull BytesStore<?,?> bytes)
Writes all available data from the specified
BytesStore into the output stream. |
default S |
write(@NotNull BytesStore<?,?> bytes,
long readOffset,
long length)
Writes the specified number of bytes from the provided
BytesStore into the output stream,
starting from the given read offset. |
default S |
write(@NotNull CharSequence text)
Writes the provided
text to this StreamingDataOutput at the current writePosition(). |
default S |
write(@NotNull CharSequence text,
int startText,
int length)
Writes the provided
text to this StreamingDataOutput at the current writePosition() |
default S |
write8bit(@Nullable CharSequence text)
Writes a CharSequence as an 8-bit string to the data stream.
|
default S |
write8bit(@NotNull CharSequence text,
int start,
int length)
Writes a subsequence of a CharSequence as an 8-bit string to the data stream.
|
default S |
write8bit(@Nullable String s)
Writes a String as an 8-bit string to the data stream.
|
S |
write8bit(@NotNull String text,
int start,
int length)
Writes a subsequence of a String as an 8-bit string to the data stream.
|
default void |
writeBigDecimal(@NotNull BigDecimal bd)
Writes the given BigDecimal into this Bytes object.
|
default void |
writeBigInteger(@NotNull BigInteger bi)
Writes the given BigInteger into this Bytes object.
|
default S |
writeBoolean(boolean flag)
Writes a boolean value to this output stream.
|
S |
writeByte(byte i8)
Writes a byte to the data stream.
|
default S |
writeChar(char ch)
Writes a char to the data stream as a stop bit encoded value.
|
S |
writeDouble(double d)
Writes a double-precision floating-point number to the data stream.
|
S |
writeDoubleAndInt(double d,
int i)
Writes a double-precision floating-point number followed by an integer to the data stream.
|
default <E extends Enum<E>> |
writeEnum(E e)
Writes an enum value to this output stream by writing the enum's name.
|
S |
writeFloat(float f)
Writes a floating-point number to the data stream.
|
default void |
writeHistogram(@NotNull net.openhft.chronicle.core.util.Histogram histogram)
Writes the given Histogram object into this Bytes object.
|
S |
writeInt(int i)
Writes an integer to the data stream.
|
default S |
writeInt24(int i)
Writes a 24-bit integer to the data stream.
|
S |
writeIntAdv(int i,
int advance)
Writes an integer to the data stream, then advances the write position by the specified amount.
|
S |
writeLimit(long limit)
Sets the maximum writeable offset.
|
S |
writeLong(long i64)
Writes a long integer to the data stream.
|
S |
writeLongAdv(long i64,
int advance)
Writes a long integer to the data stream, then advances the write position by the specified amount.
|
S |
writeOrderedInt(int i)
Writes an integer value to this output stream using an ordered-writing mechanism.
|
S |
writeOrderedLong(long i)
Writes a long value to this output stream using an ordered-writing mechanism.
|
S |
writePosition(long position)
Sets the current write position.
|
default long |
writePositionForHeader(boolean skipPadding)
Returns the current write position while optionally skipping any padding needed for a header.
|
default void |
writePositionRemaining(long position,
long length)
Sets the write position and the remaining length of writable bytes in this Bytes object.
|
S |
writeShort(short i16)
Writes a short integer to the data stream.
|
S |
writeSkip(long bytesToSkip)
Advances or rewinds the write position by
bytesToSkip. |
S |
writeSome(@NotNull ByteBuffer buffer)
Writes the available data from the provided
ByteBuffer into this Bytes object. |
default S |
writeStopBit(char x)
Writes a stop bit encoded char to the data stream.
|
default S |
writeStopBit(double d)
Writes a stop bit encoded double value to the data stream.
|
default S |
writeStopBit(long x)
Writes a stop bit encoded long to the data stream.
|
default S |
writeStopBitDecimal(double d)
Writes a double value to the data stream with a stop bit encoded decimal.
|
default S |
writeUnsignedByte(int i)
Writes an unsigned byte to the data stream.
|
default S |
writeUnsignedInt(long i)
Writes an unsigned integer to the data stream.
|
default S |
writeUnsignedInt24(int i)
Writes an unsigned 24-bit integer to the data stream.
|
default S |
writeUnsignedShort(int u16)
Writes an unsigned short integer to the data stream.
|
default S |
writeUtf8(@Nullable CharSequence text)
Writes a UTF-8 encoded string to the data stream, similar to writeUTF, but with a few differences.
|
default S |
writeUtf8(@Nullable String text)
Writes a UTF-8 encoded String to the data stream.
|
default void |
writeWithLength(@NotNull BytesStore<?,?> bytes)
Writes data from the provided RandomDataInput into this Bytes object with prefixed length.
|
default void |
writeWithLength(@NotNull RandomDataInput bytes)
Deprecated.
|
clearaddressForRead, addressForRead, addressForWrite, addressForWritePosition, byteOrder, bytesForRead, bytesForWrite, capacity, isDirectMemory, lengthWritten, readLimit, readPosition, readRemaining, realReadRemaining, realWriteRemaining, sharedMemory, start, writeLimit, writePosition, writeRemainingstatic final int JAVA9_STRING_CODER_LATIN
static final int JAVA9_STRING_CODER_UTF16
@NotNull S writePosition(long position) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
position - The new write position. It must be a non-negative number.BufferOverflowException - If the specified position exceeds the limit of the data buffer.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe way@NotNull S writeLimit(long limit) throws BufferOverflowException
BufferOverflowException.limit - The new write limit. It must be a non-negative number.BufferOverflowException - If the specified limit is less than the current write position.@NotNull S writeSkip(long bytesToSkip) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
bytesToSkip. The result
must remain within RandomCommon.writeLimit().bytesToSkip - The number of bytes to skip. This can be a negative number to move the
position backward.BufferOverflowException - If the new position calculated by the skip operation falls
outside the limits of the data buffer.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe waydefault long writePositionForHeader(boolean skipPadding)
throws net.openhft.chronicle.core.io.ClosedIllegalStateException
skipPadding - If true, aligns the write position to the next 4-byte boundary.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe way@NotNull default @NotNull OutputStream outputStream()
@NotNull default S writeStopBit(long x) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
x - The long value to be written to the data stream.BufferOverflowException - If there is insufficient space in the buffer.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe way@NotNull default S writeStopBit(char x) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
x - The char value to be written to the data stream.BufferOverflowException - If there is insufficient space in the buffer.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe way@NotNull default S writeStopBit(double d) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
d - The double value to be written to the data stream.BufferOverflowException - If there is insufficient space in the buffer.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe way@NotNull default S writeStopBitDecimal(double d) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
d - The double value to be written to the data stream.BufferOverflowException - If there is insufficient space in the buffer.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe way@NotNull default S writeUtf8(@Nullable @Nullable CharSequence text) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, IllegalArgumentException, BufferUnderflowException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
text - The string to be written. Can be null.BufferOverflowException - If there is insufficient space in the buffer.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe wayIllegalArgumentExceptionBufferUnderflowException@NotNull default S writeUtf8(@Nullable @Nullable String text) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, BufferUnderflowException, IllegalArgumentException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
text - The string to be written. Can be null.BufferOverflowException - If there is insufficient space in the buffer.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe wayBufferUnderflowExceptionIllegalArgumentException@NotNull default S write8bit(@Nullable @Nullable CharSequence text) throws BufferOverflowException, ArithmeticException, net.openhft.chronicle.core.io.ClosedIllegalStateException, BufferUnderflowException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
text - The CharSequence to be written. Can be null.BufferOverflowException - If there is insufficient space in the buffer.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe wayArithmeticExceptionBufferUnderflowException@NotNull default S write8bit(@NotNull @NotNull CharSequence text, int start, int length) throws BufferOverflowException, IndexOutOfBoundsException, ArithmeticException, net.openhft.chronicle.core.io.ClosedIllegalStateException, BufferUnderflowException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
text - The CharSequence to be written.start - The index of the first char in the CharSequence to write.length - The number of chars from the CharSequence to write.BufferOverflowException - If there is insufficient space in the buffer.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe wayIndexOutOfBoundsExceptionArithmeticExceptionBufferUnderflowException@NotNull S write8bit(@NotNull @NotNull String text, int start, int length) throws net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
text - The String to be written.start - The index of the first char in the String to write.length - The number of chars from the String to write.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe way@NotNull default S write(@NotNull @NotNull CharSequence text) throws BufferOverflowException, IndexOutOfBoundsException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
text to this StreamingDataOutput at the current writePosition().text - to writeBufferOverflowException - If the provided text cannot be accommodated.IllegalArgumentException - If the provided text is null.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe wayIndexOutOfBoundsException@NotNull default S write(@NotNull @NotNull CharSequence text, int startText, int length) throws BufferOverflowException, IndexOutOfBoundsException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
text to this StreamingDataOutput at the current writePosition()text - to writestartText - offset from where text should be copied fromlength - number of characters to write.BufferOverflowException - If the provided text cannot be accommodated.NullPointerException - If the provided text is null.IllegalArgumentException - If the provided startText or the provided length is negative.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe wayIndexOutOfBoundsException@NotNull default S write8bit(@Nullable @Nullable String s) throws BufferOverflowException, ArithmeticException, net.openhft.chronicle.core.io.ClosedIllegalStateException
s - The String to be written. Can be null.BufferOverflowException - If there is insufficient space in the buffer.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe wayArithmeticException@NotNull S writeByte(byte i8) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
i8 - The byte to be written.BufferOverflowException - If there is insufficient space in the buffer.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe waydefault S rawWriteByte(byte i8) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
i8 - The byte to be written.BufferOverflowException - If there is insufficient space in the buffer.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe way@NotNull default S writeUnsignedByte(int i) throws BufferOverflowException, ArithmeticException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
i - The integer to be written as an unsigned byte.BufferOverflowException - If there is insufficient space in the buffer.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe wayArithmeticException@NotNull default S writeChar(char ch) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
ch - The char to be written.BufferOverflowException - If there is insufficient space in the buffer.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe way@NotNull S writeShort(short i16) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
i16 - The short integer to be written.BufferOverflowException - If there is insufficient space in the buffer.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe way@NotNull default S writeUnsignedShort(int u16) throws BufferOverflowException, ArithmeticException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
u16 - The integer to be written as an unsigned short.BufferOverflowException - If there is insufficient space in the buffer.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe wayArithmeticException@NotNull default S writeInt24(int i) throws BufferOverflowException, ArithmeticException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
i - The integer to be written.BufferOverflowException - If there is insufficient space in the buffer.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe wayArithmeticException@NotNull default S writeUnsignedInt24(int i) throws BufferOverflowException, ArithmeticException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
i - The integer to be written.BufferOverflowException - If there is insufficient space in the buffer.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe wayArithmeticException@NotNull S writeInt(int i) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
i - The integer to be written.BufferOverflowException - If there is insufficient space in the buffer.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe waydefault S rawWriteInt(int i) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
i - The integer to be written.BufferOverflowException - If there is insufficient space in the buffer.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe way@NotNull S writeIntAdv(int i, int advance) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
i - The integer to be written.advance - The number of bytes to advance the write position after the integer has been written.BufferOverflowException - If there is insufficient space in the buffer.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe way@NotNull default S writeUnsignedInt(long i) throws BufferOverflowException, ArithmeticException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
i - The long to be written as an unsigned integer.BufferOverflowException - If there is insufficient space in the buffer.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe wayArithmeticException@NotNull S writeLong(long i64) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
i64 - The long integer to be written.BufferOverflowException - If there is insufficient space in the buffer.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe waydefault S rawWriteLong(long i) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
i - The long integer to be written.BufferOverflowException - If there is insufficient space in the buffer.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe way@NotNull S writeLongAdv(long i64, int advance) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
i64 - The long integer to be written.advance - The number of bytes to advance the write position after the long integer has been written.BufferOverflowException - If there is insufficient space in the buffer.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe way@NotNull S writeFloat(float f) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
f - The floating-point number to be written.BufferOverflowException - If there is insufficient space in the buffer.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe way@NotNull S writeDouble(double d) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
d - The double-precision floating-point number to be written.BufferOverflowException - If there is insufficient space in the buffer.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe way@NotNull S writeDoubleAndInt(double d, int i) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
d - The double-precision floating-point number to be written.i - The integer to be written.BufferOverflowException - If there is insufficient space in the buffer.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe waydefault S write(@NotNull @NotNull BytesStore<?,?> bytes) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
BytesStore into the output stream.
The position of this output stream is updated accordingly, but the read position of the input data is not changed.
The operation will fail if there is not enough space left in the output stream.bytes - the BytesStore from which data is read.BufferOverflowException - If there is not enough space left in the output stream.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe wayStreamingDataInput.read(Bytes)void ensureCapacity(long desiredCapacity)
throws DecoratedBufferOverflowException,
net.openhft.chronicle.core.io.ClosedIllegalStateException,
net.openhft.chronicle.core.io.ThreadingIllegalStateException
DecoratedBufferOverflowException will be thrown.desiredCapacity - the required capacity.DecoratedBufferOverflowException - If the buffer is not elastic and lacks sufficient space, or
if the provided desiredCapacity is negative.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe waylong realCapacity()
realCapacity in interface RandomCommondefault boolean canWriteDirect(long count)
count - the number of bytes to write.@NotNull default S write(@NotNull @NotNull BytesStore<?,?> bytes, long readOffset, long length) throws BufferOverflowException, BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, IllegalArgumentException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
BytesStore into the output stream,
starting from the given read offset. It ensures that the output stream has enough capacity
to accommodate the incoming bytes. The position of this output stream is updated accordingly,
but the read position of the input data is not changed.bytes - the BytesStore from which data is read.readOffset - the offset at which reading from the BytesStore starts.length - the number of bytes to write.BufferOverflowException - If there is not enough space left in the output stream.BufferUnderflowException - If there is not enough data available in the input.IllegalArgumentException - If the readOffset or length are invalid.NullPointerException - If the provided bytes object is null.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe way@NotNull default S write(byte[] byteArray) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
byteArray into the output stream. The position of the output stream
is updated according to the number of bytes written.byteArray - the array of bytes to be written.BufferOverflowException - If there is not enough space left in the output stream.NullPointerException - If the provided byteArray is null.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe way@NotNull S write(byte[] byteArray, int offset, int length) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, IllegalArgumentException, ArrayIndexOutOfBoundsException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
byteArray into the output stream, starting from the
given offset. The position of the output stream is updated according to the number of bytes written.byteArray - the array of bytes to be written.offset - the start index in the array from where to start writing bytes.length - the number of bytes to write.BufferOverflowException - If there is not enough space left in the output stream.IllegalArgumentException - If the provided offset or length is negativeNullPointerException - If the provided byteArray is nullArrayIndexOutOfBoundsException - If the provided offset and length combination is invalid.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe waydefault S unsafeWriteObject(Object o, int offset, int length) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
o - The object whose memory content is to be written.offset - The offset in bytes from the start of the object's content to begin writing from.length - The length (in bytes) of the object's content to write.BufferOverflowException - If there is not enough space left in the output stream.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe waydefault S unsafeWrite(long address, int length) throws net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
address - The address of the raw memory to write.length - The length (in bytes) of the raw memory to write.BufferOverflowException - If there is not enough space left in the output stream.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe way@NotNull S writeSome(@NotNull @NotNull ByteBuffer buffer) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, BufferUnderflowException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
ByteBuffer into this Bytes object.
The number of bytes written is constrained by the space available in this Bytes object.
The position of this Bytes object is updated according to the number of bytes written.buffer - the ByteBuffer from which data is read.BufferOverflowException - If there is not enough space left in the output stream.BufferUnderflowException - If there is not enough data available in the input ByteBuffer.NullPointerException - If the provided buffer is null.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe way@NotNull default S writeBoolean(boolean flag) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
flag - The boolean value to be written.BufferOverflowException - If there is not enough space left in the output stream.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe way@NotNull S writeOrderedInt(int i) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
i - The integer value to be written.BufferOverflowException - If there is not enough space left in the output stream.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe way@NotNull S writeOrderedLong(long i) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
i - The long value to be written.BufferOverflowException - If there is not enough space left in the output stream.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe waydefault <E extends Enum<E>> S writeEnum(@NotNull E e) throws BufferOverflowException, ArithmeticException, net.openhft.chronicle.core.io.ClosedIllegalStateException
e - The enum value to be written.BufferOverflowException - If there is not enough space left in the output stream.ArithmeticException - If a numeric error occurs.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe way@NotNull default S appendUtf8(@NotNull @NotNull CharSequence cs) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, BufferUnderflowException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
cs - The CharSequence to be appended.BufferOverflowException - If there is not enough space left in the output stream.BufferUnderflowException - If there is not enough data available in the input CharSequence.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe way@NotNull default S appendUtf8(int codepoint) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
codepoint - The Unicode code point of the character to be appended.BufferOverflowException - If there is not enough space left in the output stream.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe way@NotNull default S appendUtf8(char[] chars, int offset, int length) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, BufferUnderflowException, IllegalArgumentException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
chars - The CharSequence to be appended.offset - The offset from which to start writing the CharSequence.length - The number of characters from the CharSequence to write.BufferOverflowException - If there is not enough space left in the output stream.IndexOutOfBoundsException - If the offset or length is out of bounds for the given CharSequence.BufferUnderflowException - If there is not enough data available in the input CharSequence.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe wayIllegalArgumentException@NotNull default S appendUtf8(@NotNull @NotNull CharSequence cs, int offset, int length) throws BufferOverflowException, IndexOutOfBoundsException, net.openhft.chronicle.core.io.ClosedIllegalStateException, BufferUnderflowException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
cs - The CharSequence to be appended.offset - The offset from which to start writing the CharSequence.length - The number of characters from the CharSequence to write.BufferOverflowException - If there is not enough space left in the output stream.IndexOutOfBoundsException - If the offset or length is out of bounds for the given CharSequence.BufferUnderflowException - If there is not enough data available in the input CharSequence.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe way@NotNull default S appendUtf8(byte[] bytes, int offset, int length, byte coder) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
bytes - The byte array to be appended.offset - The offset from which to start writing the byte array.length - The number of characters (not bytes) from the byte array to write.coder - The coder indicating the encoding of the byte array.BufferOverflowException - If there is not enough space left in the output stream.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe way@NotNull default S appendUtf8(byte[] bytes, int offset, int length) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
bytes - The byte array to be appended.offset - The offset from which to start writing the byte array.length - The length of the byte array to write.BufferOverflowException - If there is not enough space left in the output stream.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe waydefault void copyFrom(@NotNull
@NotNull InputStream input)
throws IOException,
BufferOverflowException,
net.openhft.chronicle.core.io.ClosedIllegalStateException,
net.openhft.chronicle.core.io.ThreadingIllegalStateException
input - The InputStream from which data should be copied.IOException - If an I/O error occurs when reading from the InputStream.BufferOverflowException - If there is not enough space in this Bytes object to store the incoming data.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe waydefault void writePositionRemaining(long position,
long length)
throws BufferOverflowException
position - The new write position.length - The new length of writable bytes remaining.BufferOverflowException - If the provided position and length exceeds the size of the buffer.default void writeHistogram(@NotNull
@NotNull net.openhft.chronicle.core.util.Histogram histogram)
throws BufferOverflowException,
net.openhft.chronicle.core.io.ClosedIllegalStateException
histogram - The Histogram object to be written.BufferOverflowException - If there is not enough space in this Bytes object to store the Histogram.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe waydefault void writeBigDecimal(@NotNull
@NotNull BigDecimal bd)
throws BufferOverflowException,
net.openhft.chronicle.core.io.ClosedIllegalStateException,
IllegalArgumentException,
net.openhft.chronicle.core.io.ThreadingIllegalStateException
bd - The BigDecimal object to be written.BufferOverflowException - If there is not enough space in this Bytes object to store the BigDecimal.IllegalArgumentException - If the BigDecimal cannot be written.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe waydefault void writeBigInteger(@NotNull
@NotNull BigInteger bi)
throws BufferOverflowException,
net.openhft.chronicle.core.io.ClosedIllegalStateException,
IllegalArgumentException,
net.openhft.chronicle.core.io.ThreadingIllegalStateException
bi - The BigInteger object to be written.BufferOverflowException - If there is not enough space in this Bytes object to store the BigInteger.IllegalArgumentException - If the BigInteger cannot be written.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe waydefault void writeWithLength(@NotNull
@NotNull BytesStore<?,?> bytes)
throws BufferOverflowException,
net.openhft.chronicle.core.io.ClosedIllegalStateException,
net.openhft.chronicle.core.io.ThreadingIllegalStateException
bytes - The RandomDataInput source of data to be written.BufferOverflowException - If there is not enough space in this Bytes object to store the incoming data.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe way@Deprecated default void writeWithLength(@NotNull @NotNull RandomDataInput bytes) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
bytes - The RandomDataInput source of data to be written.BufferOverflowException - If there is not enough space in this Bytes object to store the incoming data.net.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException - If this resource was accessed by multiple threads in an unsafe wayCopyright © 2026 Chronicle Software Ltd. All rights reserved.