public interface LongConverter
The conversion allows encoding long values into compact, human-readable strings and vice versa, useful in contexts where storage efficiency or readability is a concern.
| Modifier and Type | Method and Description |
|---|---|
default void |
addEncode(char alias,
char as)
Introduces a character alias for encoding, facilitating the interpretation of one character
as another during encoding.
|
default boolean |
allSafeChars(WireOut wireOut)
Checks if the characters in the provided
WireOut object are "safe",
meaning they don't require additional quoting or escaping, especially in contexts
like YAML serialization. |
default void |
append(net.openhft.chronicle.bytes.Bytes<?> bytes,
long value)
Converts the given long value to a string and appends it to the provided Bytes object.
|
void |
append(StringBuilder text,
long value)
Converts the given long value to a string and appends it to the provided StringBuilder.
|
default String |
asString(long value)
Converts the given long value to a string.
|
default CharSequence |
asText(int value)
Converts the provided integer value to a CharSequence representation.
|
default CharSequence |
asText(long value)
Converts the provided long value to a CharSequence representation.
|
static LongConverter |
forSymbols(String chars)
Creates an instance of the appropriate implementation of
LongConverter
based on the length of the provided character set. |
default void |
lengthCheck(CharSequence text)
Checks that the length of the provided text does not exceed the allowable maximum.
|
default int |
maxParseLength()
Returns the maximum number of characters that this converter can parse.
|
static int |
maxParseLength(int based)
Calculates the maximum length of a parsed string based on the provided base.
|
long |
parse(CharSequence text)
Parses the provided
CharSequence and returns the parsed results as a
long primitive. |
static LongConverter forSymbols(String chars)
LongConverter
based on the length of the provided character set.chars - A set of symbols or characters to be used in the conversion.LongConverter. If the length of chars is a power of 2,
a PowerOfTwoLongConverter is returned; otherwise, a SymbolsLongConverter is returned.static int maxParseLength(int based)
based - The base for conversion.long parse(CharSequence text)
CharSequence and returns the parsed results as a
long primitive.text as an long primitive.void append(StringBuilder text, long value)
text - The StringBuilder to which the converted value is appended.value - The long value to convert.default void append(net.openhft.chronicle.bytes.Bytes<?> bytes,
long value)
bytes - The Bytes object to which the converted value is appended.value - The long value to convert.default String asString(long value)
value - The long value to convert.default CharSequence asText(int value)
value - The integer value to convert.default CharSequence asText(long value)
value - The long value to convert.default int maxParseLength()
default void lengthCheck(CharSequence text)
text - The text to check.IllegalArgumentException - if the text length exceeds the maximum allowable length.default boolean allSafeChars(WireOut wireOut)
WireOut object are "safe",
meaning they don't require additional quoting or escaping, especially in contexts
like YAML serialization.wireOut - The WireOut instance to check.true if no characters need escaping or additional quoting for YAML, false otherwise.default void addEncode(char alias,
char as)
alias - The character to treat as an alias.as - The character that the alias should be treated as.UnsupportedOperationException - If the operation is not supported.Copyright © 2023. All rights reserved.