public interface StreamingDataOutput<S extends StreamingDataOutput<S>> extends StreamingCommon<S>
The use of this instance is single threaded, though the use of the data
Modifier and Type | Field and Description |
---|---|
static int |
JAVA9_STRING_CODER_LATIN |
static int |
JAVA9_STRING_CODER_UTF16 |
Modifier and Type | Method and Description |
---|---|
long |
addressForRead(long offset)
Obtain the underlying addressForRead.
|
default long |
addressForRead(long offset,
int buffer) |
long |
addressForWrite(long offset)
Obtain the underlying addressForRead.
|
long |
addressForWritePosition() |
default S |
appendUtf8(@NotNull byte[] bytes,
int offset,
int length) |
default S |
appendUtf8(@NotNull byte[] bytes,
int offset,
int length,
byte coder) |
default S |
appendUtf8(@NotNull char[] chars,
int offset,
int length) |
default S |
appendUtf8(@NotNull CharSequence cs) |
default S |
appendUtf8(@NotNull CharSequence cs,
int offset,
int length) |
default S |
appendUtf8(int codepoint) |
default ByteOrder |
byteOrder() |
@NotNull Bytes |
bytesForRead() |
@NotNull Bytes |
bytesForWrite() |
default boolean |
canWriteDirect(long count) |
default long |
capacity() |
default boolean |
compareAndSwapDouble(long offset,
double expected,
double value)
Perform a 64-bit double CAS at a given offset.
|
default boolean |
compareAndSwapFloat(long offset,
float expected,
float value)
Perform a 32-bit float CAS at a given offset.
|
boolean |
compareAndSwapInt(long offset,
int expected,
int value)
Perform a 32-bit CAS at a given offset.
|
boolean |
compareAndSwapLong(long offset,
long expected,
long value)
Perform a 64-bit CAS at a given offset.
|
default void |
copyFrom(@NotNull InputStream input) |
boolean |
isDirectMemory() |
default long |
lengthWritten(long startPosition)
Typically this calculates the difference however for HexDumpBytes it's not as simple.
|
default @NotNull OutputStream |
outputStream() |
default S |
rawWriteByte(byte i8) |
default S |
rawWriteInt(int i) |
default S |
rawWriteLong(long i)
Write a long without a bounds check
|
default long |
readLimit() |
default long |
readPosition()
The read position must be
start() <= readPosition() && readPosition() <= readLimit() && readPosition < safeLimit() |
default long |
readRemaining() |
long |
realCapacity() |
default long |
realReadRemaining() |
default long |
realWriteRemaining() |
boolean |
sharedMemory() |
default long |
start() |
void |
testAndSetInt(long offset,
int expected,
int value) |
default S |
unsafeWrite(long address,
int length)
Write raw native memory for a fixed length
|
default S |
unsafeWriteObject(Object o,
int length) |
default S |
unsafeWriteObject(Object o,
int offset,
int length) |
default S |
write(@NotNull byte[] byteArray)
Write all data or fail.
|
S |
write(byte[] byteArray,
int offset,
int length)
Writes all data from the provided
byteArray into this Bytes object. |
default S |
write(@NotNull BytesStore bytes)
Writes all the passed BytesStore or it fails.
|
default S |
write(@NotNull BytesStore bytes,
long readOffset,
long length)
Write all data or fail.
|
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 |
write(@NotNull RandomDataInput bytes)
Write all data or fail.
|
default S |
write(@NotNull RandomDataInput bytes,
long readOffset,
long length)
Write all data or fail.
|
default S |
write8bit(@Nullable CharSequence text) |
default S |
write8bit(@NotNull CharSequence text,
int start,
int length) |
default S |
write8bit(@Nullable String s) |
S |
write8bit(@NotNull String text,
int start,
int length) |
default void |
writeBigDecimal(@NotNull BigDecimal bd) |
default void |
writeBigInteger(@NotNull BigInteger bi) |
default S |
writeBoolean(boolean flag) |
S |
writeByte(byte i8) |
default S |
writeChar(char ch) |
S |
writeDouble(double d) |
S |
writeDoubleAndInt(double d,
int i) |
default <E extends Enum<E>> |
writeEnum(E e) |
S |
writeFloat(float f) |
default void |
writeHistogram(@NotNull net.openhft.chronicle.core.util.Histogram histogram) |
S |
writeInt(int i) |
default S |
writeInt24(int i) |
S |
writeIntAdv(int i,
int advance) |
default long |
writeLimit() |
S |
writeLimit(long limit) |
S |
writeLong(long i64)
Write a long
|
S |
writeLongAdv(long i64,
int advance) |
S |
writeOrderedInt(int i) |
S |
writeOrderedLong(long i) |
default long |
writePosition()
The write position must be
readPosition() <= writePosition() && writePosition() <= writeLimit() |
S |
writePosition(long position) |
default long |
writePositionForHeader(boolean skipPadding)
obtain the writePosition skipping any padding needed for a header.
|
default void |
writePositionRemaining(long position,
long length) |
default long |
writeRemaining() |
S |
writeShort(short i16) |
S |
writeSkip(long bytesToSkip)
Skip a number of bytes by moving the writePosition.
|
S |
writeSome(@NotNull ByteBuffer buffer)
Write all data available from buffer, constrained by how much space available in this.
|
default S |
writeSome(@NotNull Bytes bytes)
Write all data available from bytes argument, constrained by how much space available in this.
|
default S |
writeStopBit(char x) |
default S |
writeStopBit(double d) |
default S |
writeStopBit(long x)
Write a stop bit encoded long
|
default S |
writeStopBitDecimal(double d) |
default S |
writeUnsignedByte(int i) |
default S |
writeUnsignedInt(long i) |
default S |
writeUnsignedInt24(int i) |
default S |
writeUnsignedShort(int u16) |
default S |
writeUtf8(@Nullable CharSequence text)
Write the same encoding as
writeUTF with the following changes. |
default S |
writeUtf8(@Nullable String text) |
default void |
writeWithLength(@NotNull RandomDataInput bytes) |
clear
static final int JAVA9_STRING_CODER_LATIN
static final int JAVA9_STRING_CODER_UTF16
@NotNull S writePosition(long position) throws BufferOverflowException
BufferOverflowException
@NotNull S writeLimit(long limit) throws BufferOverflowException
BufferOverflowException
@NotNull S writeSkip(long bytesToSkip) throws BufferOverflowException, IllegalStateException
bytesToSkip
- bytes to skip. This can be negative.BufferOverflowException
- if the offset is outside the limits of the BytesIllegalStateException
default long writePositionForHeader(boolean skipPadding)
skipPadding
- optional aligning to 4 bytes@NotNull default @NotNull OutputStream outputStream()
@NotNull default S writeStopBit(long x) throws BufferOverflowException, IllegalStateException
x
- long to writeBufferOverflowException
IllegalStateException
@NotNull default S writeStopBit(char x) throws BufferOverflowException, IllegalStateException
@NotNull default S writeStopBit(double d) throws BufferOverflowException, IllegalStateException
@NotNull default S writeStopBitDecimal(double d) throws BufferOverflowException, IllegalStateException
@NotNull default S writeUtf8(@Nullable @Nullable CharSequence text) throws BufferOverflowException, IllegalStateException, IllegalArgumentException, BufferUnderflowException
writeUTF
with the following changes. 1) The length is stop bit encoded
i.e. one byte longer for short strings, but is not limited in length. 2) The string can be null.text
- the string value to be written. Can be null.BufferOverflowException
- if there is not enough space leftIllegalStateException
IllegalArgumentException
BufferUnderflowException
@NotNull default S writeUtf8(@Nullable @Nullable String text) throws BufferOverflowException, IllegalStateException, BufferUnderflowException, IllegalArgumentException
@NotNull default S write8bit(@Nullable @Nullable CharSequence text) throws BufferOverflowException, ArithmeticException, IllegalStateException, BufferUnderflowException
@NotNull default S write8bit(@NotNull @NotNull CharSequence text, int start, int length) throws BufferOverflowException, IndexOutOfBoundsException, ArithmeticException, IllegalStateException, BufferUnderflowException
@NotNull default S write(@NotNull @NotNull CharSequence text) throws BufferOverflowException, IndexOutOfBoundsException, IllegalStateException
text
to this StreamingDataOutput at the current writePosition().text
- to writeBufferOverflowException
- if the provided text
cannot be accommodated.IllegalStateException
- if this StreamingDataOutput has been previously released.IllegalArgumentException
- if the provided text
is null
.IndexOutOfBoundsException
@NotNull default S write(@NotNull @NotNull CharSequence text, int startText, int length) throws BufferOverflowException, IndexOutOfBoundsException, IllegalStateException
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.IllegalStateException
- if this StreamingDataOutput has been previously released.NullPointerException
- if the provided text
is null
.IllegalArgumentException
- if the provided startText
or the provided length
is negative.IndexOutOfBoundsException
@NotNull default S write8bit(@Nullable @Nullable String s) throws BufferOverflowException, ArithmeticException, IllegalStateException
@NotNull S writeByte(byte i8) throws BufferOverflowException, IllegalStateException
default S rawWriteByte(byte i8) throws BufferOverflowException, IllegalStateException
@NotNull default S writeUnsignedByte(int i) throws BufferOverflowException, ArithmeticException, IllegalStateException
@NotNull default S writeChar(char ch) throws BufferOverflowException, IllegalStateException
@NotNull S writeShort(short i16) throws BufferOverflowException, IllegalStateException
@NotNull default S writeUnsignedShort(int u16) throws BufferOverflowException, ArithmeticException, IllegalStateException
@NotNull default S writeInt24(int i) throws BufferOverflowException, ArithmeticException, IllegalStateException
@NotNull default S writeUnsignedInt24(int i) throws BufferOverflowException, ArithmeticException, IllegalStateException
@NotNull S writeInt(int i) throws BufferOverflowException, IllegalStateException
default S rawWriteInt(int i) throws BufferOverflowException, IllegalStateException
@NotNull S writeIntAdv(int i, int advance) throws BufferOverflowException, IllegalStateException
@NotNull default S writeUnsignedInt(long i) throws BufferOverflowException, ArithmeticException, IllegalStateException
@NotNull S writeLong(long i64) throws BufferOverflowException, IllegalStateException
default S rawWriteLong(long i) throws BufferOverflowException, IllegalStateException
@NotNull S writeLongAdv(long i64, int advance) throws BufferOverflowException, IllegalStateException
@NotNull S writeFloat(float f) throws BufferOverflowException, IllegalStateException
@NotNull S writeDouble(double d) throws BufferOverflowException, IllegalStateException
@NotNull S writeDoubleAndInt(double d, int i) throws BufferOverflowException, IllegalStateException
@NotNull default S write(@NotNull @NotNull RandomDataInput bytes) throws BufferOverflowException, IllegalStateException
Calling this method will update the cursors of this, but not the bytes we read from.
IllegalArgumentException
- if the provided bytes
is null
BufferOverflowException
IllegalStateException
default S write(@NotNull @NotNull BytesStore bytes) throws BufferOverflowException, IllegalStateException
Calling this method will update the cursors of this, but not the bytes we read from.
bytes
- to writeBufferOverflowException
IllegalStateException
StreamingDataInput.read(Bytes)
long realCapacity()
default boolean canWriteDirect(long count)
@NotNull default S writeSome(@NotNull @NotNull Bytes bytes) throws IllegalStateException
Calling this method will update the cursors of this, but not the bytes we read from.
IllegalStateException
@NotNull default S write(@NotNull @NotNull RandomDataInput bytes, long readOffset, long length) throws BufferOverflowException, BufferUnderflowException, IllegalStateException, IllegalArgumentException
Calling this method will update the cursors of this, but not the bytes we read from.
@NotNull default S write(@NotNull @NotNull BytesStore bytes, long readOffset, long length) throws BufferOverflowException, BufferUnderflowException, IllegalStateException, IllegalArgumentException
Calling this method will update the cursors of this, but not the bytes we read from.
@NotNull default S write(@NotNull @NotNull byte[] byteArray) throws BufferOverflowException, IllegalStateException
Calling this method will update the cursors of this.
NullPointerException
- if the provided byteArray
is null
.BufferOverflowException
IllegalStateException
@NotNull S write(byte[] byteArray, int offset, int length) throws BufferOverflowException, IllegalStateException, IllegalArgumentException, ArrayIndexOutOfBoundsException
byteArray
into this Bytes object.
Invoking this method will update the cursors of this Bytes object.
IllegalArgumentException
- if the provided offset
or length
is negativeNullPointerException
- if the provided byteArray
is null
BufferOverflowException
IllegalStateException
ArrayIndexOutOfBoundsException
default S unsafeWriteObject(Object o, int length) throws BufferOverflowException, IllegalStateException
default S unsafeWriteObject(Object o, int offset, int length) throws BufferOverflowException, IllegalStateException
default S unsafeWrite(long address, int length)
@NotNull S writeSome(@NotNull @NotNull ByteBuffer buffer) throws BufferOverflowException, IllegalStateException, BufferUnderflowException
Calling this method will update the cursors of this.
@NotNull default S writeBoolean(boolean flag) throws BufferOverflowException, IllegalStateException
@NotNull S writeOrderedInt(int i) throws BufferOverflowException, IllegalStateException
@NotNull S writeOrderedLong(long i) throws BufferOverflowException, IllegalStateException
default <E extends Enum<E>> S writeEnum(@NotNull E e) throws BufferOverflowException, ArithmeticException, IllegalStateException
@NotNull default S appendUtf8(@NotNull @NotNull CharSequence cs) throws BufferOverflowException, IllegalStateException, BufferUnderflowException
@NotNull default S appendUtf8(int codepoint) throws BufferOverflowException, IllegalStateException
@NotNull default S appendUtf8(@NotNull @NotNull char[] chars, int offset, int length) throws BufferOverflowException, IllegalStateException, BufferUnderflowException, IllegalArgumentException
@NotNull default S appendUtf8(@NotNull @NotNull CharSequence cs, int offset, int length) throws BufferOverflowException, IndexOutOfBoundsException, IllegalStateException, BufferUnderflowException
@NotNull default S appendUtf8(@NotNull @NotNull byte[] bytes, int offset, int length, byte coder) throws BufferOverflowException, IllegalStateException
@NotNull default S appendUtf8(@NotNull @NotNull byte[] bytes, int offset, int length) throws BufferOverflowException, IllegalStateException
default void copyFrom(@NotNull @NotNull InputStream input) throws IOException, BufferOverflowException, IllegalStateException
default void writePositionRemaining(long position, long length) throws BufferOverflowException
BufferOverflowException
default void writeHistogram(@NotNull @NotNull net.openhft.chronicle.core.util.Histogram histogram) throws BufferOverflowException, IllegalStateException
default void writeBigDecimal(@NotNull @NotNull BigDecimal bd) throws BufferOverflowException, IllegalStateException, IllegalArgumentException
default void writeBigInteger(@NotNull @NotNull BigInteger bi) throws BufferOverflowException, IllegalStateException, IllegalArgumentException
default void writeWithLength(@NotNull @NotNull RandomDataInput bytes) throws BufferOverflowException, IllegalStateException
default long start()
default long capacity()
default long readPosition()
start() <= readPosition() && readPosition() <= readLimit() && readPosition < safeLimit()
default long writePosition()
readPosition() <= writePosition() && writePosition() <= writeLimit()
default long lengthWritten(long startPosition)
startPosition
- to compare againstdefault long readRemaining()
default long realReadRemaining()
default long writeRemaining()
default long realWriteRemaining()
default long readLimit()
default long writeLimit()
long addressForRead(long offset) throws UnsupportedOperationException, BufferUnderflowException, IllegalStateException
offset
- within this buffer. addressForRead(start()) is the actual addressForRead of the first byte.UnsupportedOperationException
- if the underlying buffer is on the heapBufferUnderflowException
- if the offset is before the start() or the after the capacity()IllegalStateException
default long addressForRead(long offset, int buffer) throws UnsupportedOperationException, BufferUnderflowException, IllegalStateException
long addressForWrite(long offset) throws UnsupportedOperationException, BufferOverflowException, IllegalStateException
offset
- within this buffer. addressForRead(start()) is the actual addressForRead of the first byte.UnsupportedOperationException
- if the underlying buffer is on the heapBufferOverflowException
- if the offset is before the start() or the after the capacity()IllegalStateException
long addressForWritePosition() throws UnsupportedOperationException, BufferOverflowException, IllegalStateException
default ByteOrder byteOrder()
@NotNull @NotNull Bytes bytesForRead() throws IllegalStateException
IllegalStateException
@NotNull @NotNull Bytes bytesForWrite() throws IllegalStateException
IllegalStateException
boolean compareAndSwapInt(long offset, int expected, int value) throws BufferOverflowException, IllegalStateException
offset
- to perform CASexpected
- valuevalue
- to setBufferOverflowException
IllegalStateException
void testAndSetInt(long offset, int expected, int value) throws BufferOverflowException, IllegalStateException
boolean compareAndSwapLong(long offset, long expected, long value) throws BufferOverflowException, IllegalStateException
offset
- to perform CASexpected
- valuevalue
- to setBufferOverflowException
IllegalStateException
default boolean compareAndSwapFloat(long offset, float expected, float value) throws BufferOverflowException, IllegalStateException
offset
- to perform CASexpected
- valuevalue
- to setBufferOverflowException
IllegalStateException
default boolean compareAndSwapDouble(long offset, double expected, double value) throws BufferOverflowException, IllegalStateException
offset
- to perform CASexpected
- valuevalue
- to setBufferOverflowException
IllegalStateException
boolean sharedMemory()
boolean isDirectMemory()
Copyright © 2022. All rights reserved.