- java.lang.Object
-
- swim.codec.Base10
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
countDigits(int value)
Returns the number of decimal digits in the given absolutevalue
.static int
countDigits(long value)
Returns the number of decimal digits in the given absolutevalue
.static Parser<Number>
decimalParser()
static int
decodeDigit(int c)
Returns the decimal quantity between0
(inclusive) and10
(exclusive) represented by the base-10 digitc
.static Writer<?,Double>
doubleWriter(long input)
Returns aWriter
continuation that writes the base-10 (decimal) encoding of theinput
value.static int
encodeDigit(int b)
Returns the Unicode code point of the base-10 digit that encodes the given decimal quantity between0
(inclusive) and10
(exclusive).static Writer<?,Float>
floatWriter(long input)
Returns aWriter
continuation that writes the base-10 (decimal) encoding of theinput
value.static Parser<Number>
integerParser()
static Writer<Integer,?>
intWriter()
Returns aWriter
that, when fed an inputInteger
value, returns a continuation that writes the base-10 (decimal) encoding of the input value.static Writer<?,Integer>
intWriter(int input)
Returns aWriter
continuation that writes the base-10 (decimal) encoding of theinput
value.static boolean
isDigit(int c)
Returnstrue
if the Unicode code pointc
is a valid base-10 digit.static Writer<Long,?>
longWriter()
Returns aWriter
that, when fed an inputLong
value, returns a continuation that writes the base-10 (decimal) encoding of the input value.static Writer<?,Long>
longWriter(long input)
Returns aWriter
continuation that writes the base-10 (decimal) encoding of theinput
value.static Parser<Number>
numberParser()
static Parser<Number>
parseDecimal(Input input)
static Parser<Number>
parseInteger(Input input)
static Parser<Number>
parseNumber(Input input)
static Writer<?,?>
writeDouble(Output<?> output, double input)
Writes the base-10 (decimal) encoding of theinput
value to theoutput
, returning aWriter
continuation that knows how to write any remaining output that couldn't be immediately generated.static Writer<?,?>
writeFloat(Output<?> output, float input)
Writes the base-10 (decimal) encoding of theinput
value to theoutput
, returning aWriter
continuation that knows how to write any remaining output that couldn't be immediately generated.static Writer<?,?>
writeInt(Output<?> output, int input)
Writes the base-10 (decimal) encoding of theinput
value to theoutput
, returning aWriter
continuation that knows how to write any remaining output that couldn't be immediately generated.static Writer<?,?>
writeLong(Output<?> output, long input)
Writes the base-10 (decimal) encoding of theinput
value to theoutput
, returning aWriter
continuation that knows how to write any remaining output that couldn't be immediately generated.
-
-
-
Method Detail
-
intWriter
public static Writer<Integer,?> intWriter()
Returns aWriter
that, when fed an inputInteger
value, returns a continuation that writes the base-10 (decimal) encoding of the input value.
-
intWriter
public static Writer<?,Integer> intWriter(int input)
Returns aWriter
continuation that writes the base-10 (decimal) encoding of theinput
value.
-
longWriter
public static Writer<Long,?> longWriter()
Returns aWriter
that, when fed an inputLong
value, returns a continuation that writes the base-10 (decimal) encoding of the input value.
-
longWriter
public static Writer<?,Long> longWriter(long input)
Returns aWriter
continuation that writes the base-10 (decimal) encoding of theinput
value.
-
floatWriter
public static Writer<?,Float> floatWriter(long input)
Returns aWriter
continuation that writes the base-10 (decimal) encoding of theinput
value.
-
doubleWriter
public static Writer<?,Double> doubleWriter(long input)
Returns aWriter
continuation that writes the base-10 (decimal) encoding of theinput
value.
-
writeInt
public static Writer<?,?> writeInt(Output<?> output, int input)
Writes the base-10 (decimal) encoding of theinput
value to theoutput
, returning aWriter
continuation that knows how to write any remaining output that couldn't be immediately generated.
-
writeLong
public static Writer<?,?> writeLong(Output<?> output, long input)
Writes the base-10 (decimal) encoding of theinput
value to theoutput
, returning aWriter
continuation that knows how to write any remaining output that couldn't be immediately generated.
-
writeFloat
public static Writer<?,?> writeFloat(Output<?> output, float input)
Writes the base-10 (decimal) encoding of theinput
value to theoutput
, returning aWriter
continuation that knows how to write any remaining output that couldn't be immediately generated.
-
writeDouble
public static Writer<?,?> writeDouble(Output<?> output, double input)
Writes the base-10 (decimal) encoding of theinput
value to theoutput
, returning aWriter
continuation that knows how to write any remaining output that couldn't be immediately generated.
-
isDigit
public static boolean isDigit(int c)
Returnstrue
if the Unicode code pointc
is a valid base-10 digit.
-
decodeDigit
public static int decodeDigit(int c)
Returns the decimal quantity between0
(inclusive) and10
(exclusive) represented by the base-10 digitc
.- Throws:
IllegalArgumentException
- ifc
is not a valid base-10 digit.
-
encodeDigit
public static int encodeDigit(int b)
Returns the Unicode code point of the base-10 digit that encodes the given decimal quantity between0
(inclusive) and10
(exclusive).
-
countDigits
public static int countDigits(int value)
Returns the number of decimal digits in the given absolutevalue
.
-
countDigits
public static int countDigits(long value)
Returns the number of decimal digits in the given absolutevalue
.
-
-