final class StringConversion extends Object
Modifier and Type | Field and Description |
---|---|
(package private) static ThreadLocal<StringBuilder> |
STRING_BUILDER_THREAD_LOCAL
Thread-local used to build Decimal strings.
|
Modifier and Type | Method and Description |
---|---|
(package private) static String |
longToString(long value)
Returns a
String object representing the specified long . |
(package private) static void |
longToString(long value,
Appendable appendable)
Creates a
String object representing the specified long and appends it to the given
appendable . |
(package private) static long |
parseLong(DecimalArithmetic arith,
DecimalRounding rounding,
CharSequence s,
int start,
int end)
Parses the given string into a long and returns it, rounding extra digits if necessary.
|
(package private) static long |
parseUnscaledDecimal(DecimalArithmetic arith,
DecimalRounding rounding,
CharSequence s,
int start,
int end)
Parses the given string into an unscaled decimal and returns it, rounding extra digits if necessary.
|
(package private) static String |
unscaledToString(DecimalArithmetic arith,
long uDecimal)
Returns a
String object representing the specified unscaled Decimal value uDecimal . |
(package private) static void |
unscaledToString(DecimalArithmetic arith,
long uDecimal,
Appendable appendable)
Constructs a
String object representing the specified unscaled Decimal value uDecimal and appends
the constructed string to the given appendable argument. |
static final ThreadLocal<StringBuilder> STRING_BUILDER_THREAD_LOCAL
static final long parseLong(DecimalArithmetic arith, DecimalRounding rounding, CharSequence s, int start, int end)
arith
- the arithmetic of the target valuerounding
- the rounding to apply if a fraction is presents
- the string to parsestart
- the start index to read characters in s
, inclusiveend
- the end index where to stop reading in characters in s
, exclusiveIndexOutOfBoundsException
- if start < 0
or end > s.length()
NumberFormatException
- if value
does not represent a valid Decimal
or if the value is too large to be
represented as a longstatic final long parseUnscaledDecimal(DecimalArithmetic arith, DecimalRounding rounding, CharSequence s, int start, int end)
arith
- the arithmetic of the target valuerounding
- the rounding to apply if extra fraction digits are presents
- the string to parsestart
- the start index to read characters in s
, inclusiveend
- the end index where to stop reading in characters in s
, exclusiveIndexOutOfBoundsException
- if start < 0
or end > s.length()
NumberFormatException
- if value
does not represent a valid Decimal
or if the value is too large to be
represented as a Decimal with the scale of the given arithmeticstatic final String longToString(long value)
String
object representing the specified long
. The argument is converted to signed
decimal representation and returned as a string, exactly as if passed to Long.toString(long)
.value
- a long
to be converted.static final void longToString(long value, Appendable appendable) throws IOException
String
object representing the specified long
and appends it to the given
appendable
.value
- a long
to be converted.appendable
- t the appendable to which the string is to be appendedIOException
- If an I/O error occurs when appending to appendable
static final String unscaledToString(DecimalArithmetic arith, long uDecimal)
String
object representing the specified unscaled Decimal value uDecimal
. The argument
is converted to signed decimal representation and returned as a string with scale
decimal places event if
trailing fraction digits are zero.uDecimal
- a unscaled Decimal to be convertedarith
- the decimal arithmetics providing the scale to applystatic final void unscaledToString(DecimalArithmetic arith, long uDecimal, Appendable appendable) throws IOException
String
object representing the specified unscaled Decimal value uDecimal
and appends
the constructed string to the given appendable argument. The value is converted to signed decimal representation
and converted to a string with scale
decimal places event if trailing fraction digits are zero.uDecimal
- a unscaled Decimal to be converted to a stringarith
- the decimal arithmetics providing the scale to applyappendable
- t the appendable to which the string is to be appendedIOException
- If an I/O error occurs when appending to appendable