public enum AppendableUtil extends Enum<AppendableUtil>
Appendable implementations such as
StringBuilder and Bytes. These helpers are used throughout
the text parsing and formatting code paths.| Modifier and Type | Method and Description |
|---|---|
static void |
append(@NotNull Appendable sb,
double value)
Appends
value to sb. |
static void |
append(@NotNull Appendable sb,
long value)
Appends
value in decimal form to sb. |
static <C extends Appendable & CharSequence> |
append(C a,
CharSequence cs,
long start,
long len)
Appends a subsequence of the specified CharSequence to an Appendable.
|
static <C extends Appendable & CharSequence> |
append(C sb,
String str)
Appends a string to an Appendable that also implements CharSequence.
|
static long |
findUtf8Length(byte[] chars)
Computes the UTF-8 byte length of the provided 8-bit encoded character array.
|
static long |
findUtf8Length(byte[] bytes,
byte coder)
Returns the number of bytes required to UTF-8 encode the supplied
bytes using the given coder representation. |
static long |
findUtf8Length(char[] chars)
Convenience overload of
findUtf8Length(char[], int, int) for the
whole array. |
static long |
findUtf8Length(char[] chars,
int offset,
int length)
Returns the UTF-8 byte length of a portion of
chars. |
static long |
findUtf8Length(@NotNull CharSequence str)
Determines how many bytes
str will occupy when encoded as UTF-8. |
static void |
parse8bit_SB1(@NotNull Bytes<?> bytes,
@NotNull StringBuilder sb,
int length)
Parses a sequence of 8-bit characters from the given Bytes input and appends them to a StringBuilder.
|
static void |
parse8bit(@NotNull StreamingDataInput bytes,
Appendable appendable,
int utflen)
Parses a sequence of 8-bit characters from the given StreamingDataInput and appends them to an Appendable.
|
static void |
parseUtf8(@NotNull BytesStore<?,?> bs,
StringBuilder sb,
boolean utf,
int length)
Decodes
length bytes from bs as either UTF-8 or ISO-8859-1
and appends the text to sb. |
static void |
read8bitAndAppend(@NotNull StreamingDataInput bytes,
@NotNull StringBuilder appendable,
@NotNull StopCharsTester tester)
Reads 8-bit characters from
bytes appending each to
appendable until tester signals a stop or the input ends. |
static void |
readUtf8AndAppend(@NotNull StreamingDataInput bytes,
@NotNull Appendable appendable,
@NotNull StopCharsTester tester)
Reads UTF-8 characters from
bytes and appends them to
appendable until tester signals a stop or the input ends. |
static void |
readUTFAndAppend(@NotNull StreamingDataInput bytes,
@NotNull Appendable appendable,
@NotNull StopCharsTester tester)
Reads 8-bit characters and appends them to
appendable until
tester requests a stop. |
static void |
setCharAt(@NotNull Appendable sb,
int index,
char ch)
Writes
ch at index in the supplied Appendable. |
static void |
setLength(@NotNull Appendable sb,
int newLength)
Adjusts the logical length of
sb. |
static AppendableUtil |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static AppendableUtil[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static AppendableUtil[] values()
for (AppendableUtil c : AppendableUtil.values()) System.out.println(c);
public static AppendableUtil valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic static void setCharAt(@NotNull
@NotNull Appendable sb,
int index,
char ch)
throws IllegalArgumentException,
BufferOverflowException
IllegalArgumentException - if sb is not a supported typeBufferOverflowException - if index exceeds the capacity of the targetpublic static void parseUtf8(@NotNull
@NotNull BytesStore<?,?> bs,
StringBuilder sb,
boolean utf,
int length)
throws UTFDataFormatRuntimeException,
BufferUnderflowException,
net.openhft.chronicle.core.io.ClosedIllegalStateException
length bytes from bs as either UTF-8 or ISO-8859-1
and appends the text to sb.utf - when true treat the bytes as UTF-8, otherwise ISO-8859-1UTFDataFormatRuntimeException - if the data is malformed UTF-8BufferUnderflowExceptionnet.openhft.chronicle.core.io.ClosedIllegalStateExceptionpublic static void setLength(@NotNull
@NotNull Appendable sb,
int newLength)
throws IllegalArgumentException,
net.openhft.chronicle.core.io.ClosedIllegalStateException,
BufferUnderflowException
IllegalArgumentExceptionnet.openhft.chronicle.core.io.ClosedIllegalStateExceptionBufferUnderflowExceptionpublic static void append(@NotNull
@NotNull Appendable sb,
double value)
throws IllegalArgumentException,
BufferOverflowException,
net.openhft.chronicle.core.io.ClosedIllegalStateException
IllegalArgumentExceptionBufferOverflowExceptionnet.openhft.chronicle.core.io.ClosedIllegalStateExceptionpublic static void append(@NotNull
@NotNull Appendable sb,
long value)
throws IllegalArgumentException,
BufferOverflowException,
net.openhft.chronicle.core.io.ClosedIllegalStateException
value in decimal form to sb.IllegalArgumentExceptionBufferOverflowExceptionnet.openhft.chronicle.core.io.ClosedIllegalStateExceptionpublic static <C extends Appendable & CharSequence> void append(@NotNull C sb, String str)
sb - the Appendable to append tostr - the String to appendpublic static void read8bitAndAppend(@NotNull
@NotNull StreamingDataInput bytes,
@NotNull
@NotNull StringBuilder appendable,
@NotNull
@NotNull StopCharsTester tester)
throws net.openhft.chronicle.core.io.ClosedIllegalStateException
bytes appending each to
appendable until tester signals a stop or the input ends.net.openhft.chronicle.core.io.ClosedIllegalStateExceptionpublic static void readUTFAndAppend(@NotNull
@NotNull StreamingDataInput bytes,
@NotNull
@NotNull Appendable appendable,
@NotNull
@NotNull StopCharsTester tester)
throws BufferUnderflowException,
net.openhft.chronicle.core.io.ClosedIllegalStateException
appendable until
tester requests a stop.BufferUnderflowExceptionnet.openhft.chronicle.core.io.ClosedIllegalStateExceptionpublic static void readUtf8AndAppend(@NotNull
@NotNull StreamingDataInput bytes,
@NotNull
@NotNull Appendable appendable,
@NotNull
@NotNull StopCharsTester tester)
throws BufferUnderflowException,
IOException,
net.openhft.chronicle.core.io.ClosedIllegalStateException
bytes and appends them to
appendable until tester signals a stop or the input ends.BufferUnderflowExceptionIOExceptionnet.openhft.chronicle.core.io.ClosedIllegalStateExceptionpublic static void parse8bit_SB1(@NotNull
@NotNull Bytes<?> bytes,
@NotNull
@NotNull StringBuilder sb,
int length)
throws BufferUnderflowException,
net.openhft.chronicle.core.io.ClosedIllegalStateException
bytes - the input Bytes to read fromsb - the StringBuilder to append the characters tolength - the number of characters to readBufferUnderflowException - If there are not enough characters available in the inputnet.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.public static void parse8bit(@NotNull
@NotNull StreamingDataInput bytes,
Appendable appendable,
int utflen)
throws BufferUnderflowException,
IOException,
net.openhft.chronicle.core.io.ClosedIllegalStateException
bytes - the input StreamingDataInput to read fromappendable - the Appendable to append the characters toutflen - the number of characters to readBufferUnderflowException - If there are not enough characters available in the inputIOException - If an I/O error occursnet.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.public static <C extends Appendable & CharSequence> void append(C a, CharSequence cs, long start, long len) throws ArithmeticException, BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException, BufferOverflowException
a - the Appendable to append the characters tocs - the CharSequence to read characters fromstart - the starting index of the subsequencelen - the number of characters in the subsequenceArithmeticException - If an arithmetic error occursBufferUnderflowException - If there are not enough characters available in the CharSequencenet.openhft.chronicle.core.io.ClosedIllegalStateException - If the resource has been released or closed.BufferOverflowException - If the Appendable cannot accept more characterspublic static long findUtf8Length(@NotNull
@NotNull CharSequence str)
throws IndexOutOfBoundsException
str will occupy when encoded as UTF-8.IndexOutOfBoundsExceptionpublic static long findUtf8Length(byte[] bytes,
byte coder)
bytes using the given coder representation.public static long findUtf8Length(byte[] chars)
public static long findUtf8Length(char[] chars,
int offset,
int length)
chars.public static long findUtf8Length(char[] chars)
findUtf8Length(char[], int, int) for the
whole array.Copyright © 2026 Chronicle Software Ltd. All rights reserved.