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<?> text,
long value)
Appends a long value to a Bytes object.
|
void |
append(StringBuilder text,
long value)
Appends a long value to a StringBuilder.
|
int |
maxParseLength()
Returns the maximum number of characters that this converter can parse.
|
long |
parse(CharSequence text)
Parses a sequence of characters into a long value.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitallSafeChars, asString, asText, asText, forSymbols, 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 text)
parse in interface LongConvertertext - the character sequence to parseIllegalArgumentException - if the character sequence contains unexpected characterspublic void append(StringBuilder text, long value)
append in interface LongConvertertext - the StringBuilder to append tovalue - the long value to appendpublic void append(net.openhft.chronicle.bytes.Bytes<?> text,
long value)
append in interface LongConvertertext - the Bytes object to append tovalue - 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 © 2023. All rights reserved.