B
- the type that extends ByteStringAppenderpublic interface ByteStringAppender<B extends ByteStringAppender<B>> extends StreamingDataOutput<B>, Appendable
JAVA9_STRING_CODER_LATIN, JAVA9_STRING_CODER_UTF16
Modifier and Type | Method and Description |
---|---|
long |
addressForRead(long offset)
Retrieves the underlying memory address for reading.
|
default long |
addressForRead(long offset,
int buffer)
Retrieves the underlying memory address for reading.
|
long |
addressForWrite(long offset)
Retrieves the underlying memory address for writing.
|
long |
addressForWritePosition()
Retrieves the underlying memory address for writing at the current write position.
|
default B |
append(@NotNull BigDecimal bigDecimal)
Appends a string representation of a specified BigDecimal to this.
|
default B |
append(boolean flag)
Appends a boolean as 'T' or 'F' character.
|
default B |
append(char ch)
Appends a UTF-8 encoded character to the buffer.
|
default B |
append(@NotNull CharSequence cs)
Append a characters in UTF-8
|
default B |
append(@NotNull CharSequence cs,
int start,
int end)
Appends a portion of a string to the Bytes in UTF-8.
|
default B |
append(double d)
Appends a double in decimal notation
|
default B |
append(double d,
int decimalPlaces)
Appends a double in decimal notation to a specific number of decimal places.
|
default B |
append(float f)
Appends a float in decimal notation
|
default B |
append(int value)
Appends an int in decimal to this.
|
default B |
append(long value)
Appends a long value in decimal.
|
default B |
append8bit(@NotNull BytesStore bs)
Appends the ISO-8859-1 representation of the specified BytesStore.
|
default B |
append8bit(@NotNull BytesStore bs,
long start,
long end)
Appends a portion of a BytesStore to this in ISO-8859-1 format.
|
default B |
append8bit(@NotNull CharSequence cs)
Appends a String to the Bytes in ISO-8859-1.
|
default B |
append8bit(@NotNull CharSequence cs,
int start,
int end)
Appends a portion of a string to this Bytes in ISO-8859-1.
|
default B |
append8bit(@NotNull String cs)
Appends the ISO-8859-1 representation of the specified String.
|
default B |
appendBase(long value,
int base)
Appends a string representation of the first argument in the radix specified by the second argument.
|
default B |
appendBase16(long value)
Appends the base 16 (hexadecimal) representation of the specified long value.
|
default B |
appendBase16(long value,
int minDigits)
Appends the base 16 (hexadecimal) representation of the specified long value,
padding with leading zeroes if the number of digits is less than minDigits.
|
default B |
appendDateMillis(long dateInMillis)
Converts a specified long number to a date in the format yyyymmdd and appends the date to this.
|
default B |
appendDecimal(long value,
int decimalPlaces)
Appends a long in decimal with a given number of decimal places.
|
default B |
appendTimeMillis(long timeOfDayInMillis)
Converts a specified long number to time of day and appends it to this.
|
default ByteOrder |
byteOrder()
Retrieves the byte order used by the buffer.
|
@NotNull Bytes<?> |
bytesForRead()
Retrieves a Bytes object for reading.
|
@NotNull Bytes<?> |
bytesForWrite()
Retrieves a Bytes object for writing.
|
default long |
capacity() |
Decimaliser |
decimaliser()
Gets the Decimaliser currently associated with this ByteStringAppender.
|
B |
decimaliser(Decimaliser decimaliser)
Associates a Decimaliser with this ByteStringAppender.
|
boolean |
fpAppend0() |
B |
fpAppend0(boolean append0) |
boolean |
isDirectMemory()
Checks if the buffer uses direct memory.
|
default long |
lengthWritten(long startPosition)
Calculates the length of data written from the given start position.
|
default long |
readLimit()
If the resource is closed, the returned value is unspecified.
|
default long |
readPosition()
Returns the read position.
|
default long |
readRemaining()
Calculates the number of bytes remaining that can be read from the current read position.
|
default long |
realReadRemaining()
Calculates the number of bytes that can be safely read directly.
|
default long |
realWriteRemaining()
Calculates the number of bytes remaining that can be written from the current write position with resizing.
|
boolean |
sharedMemory()
Checks if the Bytes use shared memory.
|
default long |
start() |
default long |
writeLimit()
Retrieves the maximum writable position within the buffer.
|
default long |
writePosition()
Returns the write position.
|
default @NotNull Writer |
writer()
Returns the current ByteStringAppender instance as a Writer.
|
default long |
writeRemaining()
Calculates the number of bytes remaining that can be written from the current write position.
|
appendUtf8, appendUtf8, appendUtf8, appendUtf8, appendUtf8, appendUtf8, canWriteDirect, copyFrom, ensureCapacity, outputStream, rawWriteByte, rawWriteInt, rawWriteLong, realCapacity, unsafeWrite, unsafeWriteObject, unsafeWriteObject, write, write, write, write, write, write, write, write, write8bit, write8bit, write8bit, write8bit, writeBigDecimal, writeBigInteger, writeBoolean, writeByte, writeChar, writeDouble, writeDoubleAndInt, writeEnum, writeFloat, writeHistogram, writeInt, writeInt24, writeIntAdv, writeLimit, writeLong, writeLongAdv, writeOrderedInt, writeOrderedLong, writePosition, writePositionForHeader, writePositionRemaining, writeShort, writeSkip, writeSome, writeStopBit, writeStopBit, writeStopBit, writeStopBitDecimal, writeUnsignedByte, writeUnsignedInt, writeUnsignedInt24, writeUnsignedShort, writeUtf8, writeUtf8, writeWithLength
clear
@NotNull default @NotNull Writer writer()
@NotNull default B append(char ch) throws IllegalStateException
append
in interface Appendable
ch
- the character to appendBufferOverflowException
- If the append operation exceeds the buffer's capacitynet.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 wayIllegalStateException
@NotNull default B append(@NotNull @NotNull CharSequence cs)
append
in interface Appendable
cs
- the CharSequence to appendBufferUnderflowException
- If the capacity of the underlying buffer was exceedednet.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 B append(boolean flag) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
flag
- to appendBufferOverflowException
- If the relative append operation exceeds the underlying buffer's capacitynet.openhft.chronicle.core.io.IORuntimeException
- If an error occurred while attempting to resize the underlying buffernet.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 B append(int value) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
value
- the integer value to appendBufferOverflowException
- If the relative append operation exceeds the underlying buffer's capacitynet.openhft.chronicle.core.io.IORuntimeException
- If an error occurred while attempting to resize the underlying buffernet.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 B append(long value) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
value
- the long number to appendBufferOverflowException
- If the relative append operation exceeds the underlying buffer's capacitynet.openhft.chronicle.core.io.IORuntimeException
- If an error occurred while attempting to resize the underlying buffernet.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 B appendBase(long value, int base) throws BufferOverflowException, IllegalArgumentException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
value
- the number to appendbase
- the radix that the specified value should be converted to before appendBufferOverflowException
- If the relative append operation exceeds the underlying buffer's capacityIllegalArgumentException
- If the specified arguments are illegalnet.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 B appendBase16(long value) throws BufferOverflowException, IllegalArgumentException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
value
- the long value to be converted to base 16 and appendedBufferOverflowException
- If the relative append operation exceeds the underlying buffer's capacityIllegalArgumentException
- If the specified argument is illegalnet.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 B appendBase16(long value, int minDigits) throws BufferOverflowException, IllegalArgumentException, IllegalStateException
value
- the long value to be converted to base 16 and appendedminDigits
- the minimum number of digits to be appendedBufferOverflowException
- If the relative append operation exceeds the underlying buffer's capacityIllegalArgumentException
- If the specified argument is illegalnet.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.IllegalStateException
@NotNull default B appendDecimal(long value, int decimalPlaces) throws BufferOverflowException, IllegalStateException, IllegalArgumentException
value
- to appenddecimalPlaces
- to shift the decimal placeBufferOverflowException
- If the relative append operation exceeds the underlying buffer's capacitynet.openhft.chronicle.core.io.IORuntimeException
- If an error occurred while attempting to resize the underlying bufferIllegalArgumentException
- If the decimalPlaces is negative or too largenet.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.IllegalStateException
@NotNull default B append(float f) throws BufferOverflowException, IllegalStateException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
f
- the float number to appendBufferOverflowException
- If the relative append operation exceeds the underlying buffer's capacitynet.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.IllegalStateException
@NotNull default B append(double d) throws BufferOverflowException, IllegalStateException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
d
- to appendBufferOverflowException
- If the capacity of the underlying buffer was exceedednet.openhft.chronicle.core.io.IORuntimeException
- If an error occurred while attempting to resize the underlying buffernet.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.IllegalStateException
Decimaliser decimaliser()
B decimaliser(Decimaliser decimaliser)
The Decimaliser is an interface which can be implemented to provide custom logic for rendering decimal numbers in this ByteStringAppender.
decimaliser
- The Decimaliser to be associated with this ByteStringAppender.boolean fpAppend0()
B fpAppend0(boolean append0)
append0
- Does floating point add .0 to indicate it is a floating point even if redundant.@NotNull default B append(double d, int decimalPlaces) throws BufferOverflowException, IllegalArgumentException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
If the number would normally be printed with more decimal places, the number is rounded.
d
- to appenddecimalPlaces
- to always produceBufferOverflowException
- If the capacity of the underlying buffer was exceedednet.openhft.chronicle.core.io.IORuntimeException
- If an error occurred while attempting to resize the underlying bufferIllegalArgumentException
- If the decimalPlaces is negative or too largenet.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 B append(@NotNull @NotNull CharSequence cs, int start, int end) throws IndexOutOfBoundsException
append
in interface Appendable
cs
- the CharacterSequence to appendstart
- index of the first char inclusiveend
- index of the last char exclusiveBufferOverflowException
- If the capacity of the underlying buffer was exceededIndexOutOfBoundsException
- If the specified indexes are out of rangenet.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 B append8bit(@NotNull @NotNull CharSequence cs) throws BufferOverflowException, BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
cs
- the CharSequence to appendBufferOverflowException
- If the string is too large to write in the capacity availableBufferUnderflowException
- If the capacity of the underlying buffer was exceedednet.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.default B append8bit(@NotNull @NotNull BytesStore bs) throws BufferOverflowException, BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
bs
- the BytesStore to appendBufferOverflowException
- If the BytesStore is too large to write in the capacity availableBufferUnderflowException
- If the capacity of the underlying buffer was exceedednet.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.default B append8bit(@NotNull @NotNull String cs) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
cs
- the String to appendBufferOverflowException
- If the string is too large to write in the capacity availablenet.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.default B append8bit(@NotNull @NotNull CharSequence cs, int start, int end) throws IllegalArgumentException, BufferOverflowException, BufferUnderflowException, IndexOutOfBoundsException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
cs
- the CharSequence to appendstart
- index of the first char of cs (inclusive) to appendend
- index of the last char of cs (exclusive) to appendBufferOverflowException
- If the string is too large to write in the capacity availableBufferUnderflowException
- If the capacity of the underlying buffer was exceededIndexOutOfBoundsException
- If the start or the end are not valid for the CharSequenceIllegalArgumentException
- If the start or end is negative or too largenet.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.default B append8bit(@NotNull @NotNull BytesStore bs, long start, long end) throws IllegalArgumentException, BufferOverflowException, BufferUnderflowException, IndexOutOfBoundsException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
bs
- the specified BytesStore that a portion of it will be appended to thisstart
- the index of first byte (inclusive) of bs to appendend
- the number of bytes of bs to appendIllegalArgumentException
- If an illegal argument is passed to the methodBufferOverflowException
- If the relative append operation exceeds the underlying buffer's capacityBufferUnderflowException
- If the capacity of the BytesStore was exceededIndexOutOfBoundsException
- If the specified indexes for the BytesStore are out of rangenet.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 B appendDateMillis(long dateInMillis) throws BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
dateInMillis
- the specified long to convert to date and append to thisBufferOverflowException
- If the relative append operation exceeds the underlying buffer's capacitynet.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 B appendTimeMillis(long timeOfDayInMillis) throws BufferOverflowException, IllegalArgumentException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
Twelve bytes in the format of hh:mm:ss.ddd will be appended to this. hh, mm, ss and ddd represent hour, minute, second and millisecond.
timeOfDayInMillis
- the long number that represents time of day in millisecondsBufferOverflowException
- If the relative append operation exceeds the underlying buffer's capacityIllegalArgumentException
- If an illegal argument is passed to the methodnet.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 B append(@NotNull @NotNull BigDecimal bigDecimal) throws net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
The string representation of the BigDecimal number is a standard canonical string form as
described in BigDecimal.toString()
.
bigDecimal
- the specified BigDecimal to appendnet.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.BigDecimal
default long start()
default long capacity()
default long readPosition()
The read position is start() <= readPosition() && readPosition() <= readLimit() && readPosition < safeLimit()
If the resource is closed, the returned value is unspecified.
default long writePosition()
The write position is readPosition() <= writePosition() && writePosition() <= writeLimit()
If the resource is closed, the returned value is unspecified.
default long lengthWritten(long startPosition)
Typically this calculates the difference however for HexDumpBytes it's not as simple.
If the resource is closed, the returned value is unspecified.
startPosition
- The position to calculate the length from.default long readRemaining()
If the resource is closed, the returned value is unspecified.
default long realReadRemaining()
If the resource is closed, the returned value is unspecified.
default long writeRemaining()
If the resource is closed, the returned value is unspecified.
default long realWriteRemaining()
If the resource is closed, the returned value is unspecified.
default long readLimit()
If the resource is closed, the returned value is unspecified.
default long writeLimit()
If the resource is closed, the returned value is unspecified.
long addressForRead(long offset) throws UnsupportedOperationException, BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
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()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 addressForRead(long offset, int buffer) throws UnsupportedOperationException, BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
offset
- The offset within this buffer.buffer
- The buffer index.UnsupportedOperationException
- If the underlying buffer is on the heap.BufferUnderflowException
- If the offset is before the start or after the capacity.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 addressForWrite(long offset) throws UnsupportedOperationException, BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
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()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 addressForWritePosition() throws UnsupportedOperationException, BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
UnsupportedOperationException
- If the underlying buffer is on the heap.BufferOverflowException
- If the current write position is before the start or after the capacity.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 ByteOrder byteOrder()
@NotNull @NotNull Bytes<?> bytesForRead() throws net.openhft.chronicle.core.io.ClosedIllegalStateException, net.openhft.chronicle.core.io.ThreadingIllegalStateException
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 @NotNull Bytes<?> bytesForWrite() throws net.openhft.chronicle.core.io.ClosedIllegalStateException
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 wayboolean sharedMemory()
boolean isDirectMemory()
Copyright © 2023. All rights reserved.