public class PowerOfTwoLongConverter extends Object implements LongConverter
LongConverter interface
for converting long values to and from strings using power-of-two bases.
This converter leverages certain mathematical properties of power-of-two bases to optimize the conversion process.
| Constructor and Description |
|---|
PowerOfTwoLongConverter(String symbols)
Initializes a new instance with a given set of symbols.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addEncode(char alias,
char as)
Adds an alias character for encoding.
|
void |
append(net.openhft.chronicle.bytes.Bytes<?> destination,
long numericValue)
Appends a long value to a Bytes object.
|
void |
append(StringBuilder destinationBuilder,
long numericValue)
Appends a long value to a StringBuilder.
|
int |
maxParseLength()
Returns the maximum number of characters that this converter can parse.
|
long |
parse(CharSequence textToParse)
Parses a sequence of characters into a long value.
|
long |
parse(CharSequence textToParse,
int beginIndex,
int endIndex)
Parses a part of a sequence of characters into a long value.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitallSafeChars, asString, asText, asText, forSymbols, lengthCheck, lengthCheck, maxParseLengthpublic PowerOfTwoLongConverter(String symbols)
symbols - A string containing unique symbols for conversion. The length of this string
should be a power of 2.public int maxParseLength()
LongConvertermaxParseLength in interface LongConverterpublic long parse(CharSequence textToParse)
parse in interface LongConvertertextToParse - the character sequence to parseIllegalArgumentException - if the character sequence contains unexpected characters or its length
exceeds the maximum allowable length.public long parse(CharSequence textToParse, int beginIndex, int endIndex)
parse in interface LongConvertertextToParse - the character sequence to parsebeginIndex - the beginning index, inclusiveendIndex - the ending index, exclusiveIllegalArgumentException - if the character sequence contains unexpected character, or if any of
the indices are invalid or the sub-sequence length exceeds the maximum allowable length.public void append(StringBuilder destinationBuilder, long numericValue)
append in interface LongConverterdestinationBuilder - the StringBuilder to append tonumericValue - the long value to appendpublic void append(net.openhft.chronicle.bytes.Bytes<?> destination,
long numericValue)
append in interface LongConverterdestination - the Bytes object to append tonumericValue - the long value to appendpublic void addEncode(char alias,
char as)
addEncode in interface LongConverteralias - The character to treat as an alias.as - The character that the alias should be treated as.Copyright © 2026 Chronicle Software Ltd. All rights reserved.