public enum AppendableUtil extends Enum<AppendableUtil>
Modifier and Type | Method and Description |
---|---|
static void |
append(@NotNull Appendable sb,
double value)
Appends a double value to the given Appendable.
|
static void |
append(@NotNull Appendable sb,
long value)
Appends a long value to the given Appendable.
|
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)
Calculates the length of a byte array in UTF-8 format.
|
static long |
findUtf8Length(byte[] bytes,
byte coder)
Calculates the length of a byte array in UTF-8 format.
|
static long |
findUtf8Length(char[] chars)
Calculates the length of a character array in UTF-8 format.
|
static long |
findUtf8Length(char[] chars,
int offset,
int length)
Calculates the length of a character array in UTF-8 format, from a given offset up to the specified length.
|
static long |
findUtf8Length(@NotNull CharSequence str)
Calculates the length of a CharSequence in UTF-8 format.
|
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)
Parses a UTF-8 BytesStore into a StringBuilder.
|
static void |
read8bitAndAppend(@NotNull StreamingDataInput bytes,
@NotNull StringBuilder appendable,
@NotNull StopCharsTester tester)
Reads an 8-bit character from a StreamingDataInput and appends it to a StringBuilder
until a stop character as defined by the given StopCharsTester is encountered.
|
static void |
readUtf8AndAppend(@NotNull StreamingDataInput bytes,
@NotNull Appendable appendable,
@NotNull StopCharsTester tester)
Reads a UTF-8 encoded character from a StreamingDataInput and appends it to an Appendable
until a stop character as defined by the given StopCharsTester is encountered.
|
static void |
readUTFAndAppend(@NotNull StreamingDataInput bytes,
@NotNull Appendable appendable,
@NotNull StopCharsTester tester)
Reads an 8-bit character from a StreamingDataInput and appends it to an Appendable
until a stop character as defined by the given StopCharsTester is encountered.
|
static void |
setCharAt(@NotNull Appendable sb,
int index,
char ch)
Sets a character at a specified index in the given Appendable.
|
static void |
setLength(@NotNull Appendable sb,
int newLength)
Sets the length of the given Appendable.
|
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
sb
- the Appendable to modifyindex
- the index at which to set the characterch
- the character to setIllegalArgumentException
- If the Appendable is not of type StringBuilder or BytesBufferOverflowException
- If the index is larger than the buffer's capacitypublic static void parseUtf8(@NotNull @NotNull BytesStore<?,?> bs, StringBuilder sb, boolean utf, int length) throws UTFDataFormatRuntimeException, BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
bs
- the BytesStore to parsesb
- the StringBuilder to append toutf
- whether to parse as UTF-8length
- the length of characters to parseUTFDataFormatRuntimeException
- If invalid UTF-8 sequence is encounteredBufferUnderflowException
- If the BytesStore doesn't contain enough datanet.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.public static void setLength(@NotNull @NotNull Appendable sb, int newLength) throws IllegalArgumentException, net.openhft.chronicle.core.io.ClosedIllegalStateException, BufferUnderflowException
sb
- the Appendable to modifynewLength
- the new length to setIllegalArgumentException
- If the Appendable is not of type StringBuilder or Bytesnet.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.BufferUnderflowException
- If the new length is greater than the Bytes's capacitypublic static void append(@NotNull @NotNull Appendable sb, double value) throws IllegalArgumentException, BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
sb
- the Appendable to append tovalue
- the double value to appendIllegalArgumentException
- If the Appendable is not of type StringBuilder or BytesBufferOverflowException
- If there is not enough space in the Bytes to append the valuenet.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.public static void append(@NotNull @NotNull Appendable sb, long value) throws IllegalArgumentException, BufferOverflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
sb
- the Appendable to append tovalue
- the long value to appendIllegalArgumentException
- If the Appendable is not of type StringBuilder or BytesBufferOverflowException
- If there is not enough space in the Bytes to append the valuenet.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.public 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
- the StreamingDataInput to read fromappendable
- the StringBuilder to append totester
- the StopCharsTester defining the stop characternet.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.public static void readUTFAndAppend(@NotNull @NotNull StreamingDataInput bytes, @NotNull @NotNull Appendable appendable, @NotNull @NotNull StopCharsTester tester) throws BufferUnderflowException, net.openhft.chronicle.core.io.ClosedIllegalStateException
bytes
- the StreamingDataInput to read fromappendable
- the Appendable to append totester
- the StopCharsTester defining the stop characterBufferUnderflowException
- If the StreamingDataInput is exhaustednet.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.public 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
- the StreamingDataInput to read fromappendable
- the Appendable to append totester
- the StopCharsTester defining the stop characterBufferUnderflowException
- If the StreamingDataInput is exhaustedIOException
- If an I/O error occursnet.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.public 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
- the CharSequence to calculate the length ofIndexOutOfBoundsException
- If the CharSequence has invalid indicespublic static long findUtf8Length(byte[] bytes, byte coder)
bytes
- the byte array to calculate the length ofcoder
- a coder indicating the type of the contentpublic static long findUtf8Length(byte[] chars)
chars
- the byte array to calculate the length ofpublic static long findUtf8Length(char[] chars, int offset, int length)
chars
- the character array to calculate the length ofoffset
- the starting index in the character arraylength
- the number of characters to include in the calculationpublic static long findUtf8Length(char[] chars)
chars
- the character array to calculate the length ofCopyright © 2024. All rights reserved.