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) |
byte[] |
internalNumberBuffer()
Deprecated.
|
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, 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 capacityIllegalStateException
- if the underlying ByteStringAppender is closed@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 exceeded@NotNull default B append(boolean flag) throws BufferOverflowException, IllegalStateException
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 bufferIllegalStateException
- if the underlying buffer was released@NotNull default B append(int value) throws BufferOverflowException, IllegalStateException
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 bufferIllegalStateException
- if the underlying buffer was released@NotNull default B append(long value) throws BufferOverflowException, IllegalStateException
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 bufferIllegalStateException
- if the underlying buffer was released@NotNull default B appendBase(long value, int base) throws BufferOverflowException, IllegalArgumentException, IllegalStateException
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 illegalIllegalStateException
- if the underlying buffer was released@NotNull default B appendBase16(long value) throws BufferOverflowException, IllegalArgumentException, IllegalStateException
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 illegalIllegalStateException
- if the underlying buffer was released@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 illegalIllegalStateException
- if the underlying buffer was released@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 bufferIllegalStateException
- if the underlying buffer was releasedIllegalArgumentException
- if the decimalPlaces is negative or too large@NotNull default B append(float f) throws BufferOverflowException, IllegalStateException
f
- the float number to appendBufferOverflowException
- if the relative append operation exceeds the underlying buffer's capacityIllegalStateException
- if the underlying Bytes was closed@NotNull default B append(double d) throws BufferOverflowException, IllegalStateException
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 bufferIllegalStateException
- if the underlying buffer was releasedDecimaliser 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, IllegalStateException
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 bufferIllegalStateException
- if the underlying buffer was releasedIllegalArgumentException
- if the decimalPlaces is negative or too large@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 range@NotNull default B append8bit(@NotNull @NotNull CharSequence cs) throws BufferOverflowException, BufferUnderflowException, IllegalStateException
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 exceededIllegalStateException
- if the underlying buffer was releaseddefault B append8bit(@NotNull @NotNull BytesStore bs) throws BufferOverflowException, BufferUnderflowException, IllegalStateException
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 exceededIllegalStateException
- if the BytesStore is closeddefault B append8bit(@NotNull @NotNull String cs) throws BufferOverflowException, IllegalStateException
cs
- the String to appendBufferOverflowException
- if the string is too large to write in the capacity availableIllegalStateException
- if the underlying BytesStore is closeddefault B append8bit(@NotNull @NotNull CharSequence cs, int start, int end) throws IllegalArgumentException, BufferOverflowException, BufferUnderflowException, IndexOutOfBoundsException, IllegalStateException
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 CharSequenceIllegalStateException
- if the underlying buffer was releasedIllegalArgumentException
- if the start or end is negative or too largedefault B append8bit(@NotNull @NotNull BytesStore bs, long start, long end) throws IllegalArgumentException, BufferOverflowException, BufferUnderflowException, IndexOutOfBoundsException, IllegalStateException
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 rangeIllegalStateException
- if the underlying Bytes is closed@NotNull default B appendDateMillis(long dateInMillis) throws BufferOverflowException, IllegalStateException
dateInMillis
- the specified long to convert to date and append to thisBufferOverflowException
- if the relative append operation exceeds the underlying buffer's capacityIllegalStateException
- if the underlying Bytes is closed@NotNull default B appendTimeMillis(long timeOfDayInMillis) throws BufferOverflowException, IllegalStateException, IllegalArgumentException
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 capacityIllegalStateException
- if the underlying Bytes is closedIllegalArgumentException
- if an illegal argument is passed to the method@NotNull default B append(@NotNull @NotNull BigDecimal bigDecimal)
The string representation of the BigDecimal number is a standard canonical string form as
described in BigDecimal.toString()
.
bigDecimal
- the specified BigDecimal to appendBigDecimal
@Deprecated byte[] internalNumberBuffer()
internalNumberBuffer
in interface StreamingDataOutput<B extends ByteStringAppender<B>>
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, 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
- if the buffer has been closed.default long addressForRead(long offset, int buffer) throws UnsupportedOperationException, BufferUnderflowException, IllegalStateException
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.IllegalStateException
- if the buffer has been closed.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
UnsupportedOperationException
- if the underlying buffer is on the heap.BufferOverflowException
- if the current write position is before the start or after the capacity.IllegalStateException
- if the buffer state doesn't allow the operation.default ByteOrder byteOrder()
@NotNull @NotNull Bytes<?> bytesForRead() throws IllegalStateException
IllegalStateException
- if the buffer state doesn't allow the operation.@NotNull @NotNull Bytes<?> bytesForWrite() throws IllegalStateException
IllegalStateException
- if the buffer state doesn't allow the operation.boolean sharedMemory()
boolean isDirectMemory()
Copyright © 2023. All rights reserved.