java.lang.Object
swim.codec.Base16
-
Method Summary
Modifier and TypeMethodDescriptionalphabet()
Returns a 16 character string, where the character at indexi
is the encoding of the base-16 digiti
.Writer<byte[],
?> Returns aWriter
that, when fed an inputbyte[]
array, returns a continuation that writes the base-16 (hexadecimal) encoding of the input byte array.Writer<?,
byte[]> byteArrayWriter
(byte[] input) Returns aWriter
continuation that writes the base-16 (hexadecimal) encoding of theinput
byte array.Writer<ByteBuffer,
?> Returns aWriter
that, when fed an inputByteBuffer
, returns a continuation that writes the base-16 (hexadecimal) encoding of the input byte buffer.Writer<?,
ByteBuffer> byteBufferWriter
(ByteBuffer input) Returns aWriter
continuation that writes the base-16 (hexadecimal) encoding of theinput
byte buffer.static int
decodeDigit
(int c) Returns the 4-bit quantity represented by the base-16 digitc
.char
encodeDigit
(int b) Returns the Unicode code point of the base-16 digit that encodes the given 4-bit quantity.static boolean
isDigit
(int c) Returnstrue
if the Unicode code pointc
is a valid base-16 digit.static Base16
Returns theBase16
encoding with lowercase alphanumeric digits.static <O> Parser<O>
Parses the base-16 (hexadecimal) encodedinput
, and writes the decoded bytes tooutput
, returning aParser
continuation that knows how to parse any additional input.static Parser<byte[]>
parseByteArray
(Input input) Parses the base-16 (hexadecimal) encodedinput
, and writes the decoded bytes to a growable array, returning aParser
continuation that knows how to parse any additional input.static Parser<ByteBuffer>
parseByteBuffer
(Input input) Parses the base-16 (hexadecimal) encodedinput
, and writes the decoded bytes to a growable buffer, returning aParser
continuation that knows how to parse any additional input.static <O> Parser<O>
Returns aParser
that decodes base-16 (hexadecimal) encoded input, and writes the decoded bytes tooutput
.static Base16
Returns theBase16
encoding with uppercase alphanumeric digits.Writer<?,
?> writeByteArray
(Output<?> output, byte[] input) Writes the base-16 (hexadecimal) encoding of theinput
byte array to theoutput
, returning aWriter
continuation that knows how to write any remaining output that couldn't be immediately generated.Writer<?,
?> writeByteBuffer
(Output<?> output, ByteBuffer input) Writes the base-16 (hexadecimal) encoding of theinput
byte buffer to theoutput
, returning aWriter
continuation that knows how to write any remaining output that couldn't be immediately generated.Writer<?,
?> Writer<?,
?> Writer<?,
?> writeIntLiteral
(Output<?> output, int input) Writer<?,
?> writeIntLiteral
(Output<?> output, int input, int width) Writer<?,
?> Writer<?,
?> Writer<?,
?> writeLongLiteral
(Output<?> output, long input) Writer<?,
?> writeLongLiteral
(Output<?> output, long input, int width) static <T> Output<T>
writeQuantum
(Output<T> output, int c1, int c2) s Decodes the base-16 digitsc1
andc2
, and writes the 8-bit quantity they represent to the givenoutput
.
-
Method Details
-
alphabet
Returns a 16 character string, where the character at indexi
is the encoding of the base-16 digiti
. -
encodeDigit
public char encodeDigit(int b) Returns the Unicode code point of the base-16 digit that encodes the given 4-bit quantity. -
byteArrayWriter
Returns aWriter
that, when fed an inputbyte[]
array, returns a continuation that writes the base-16 (hexadecimal) encoding of the input byte array. -
byteArrayWriter
Returns aWriter
continuation that writes the base-16 (hexadecimal) encoding of theinput
byte array. -
byteBufferWriter
Returns aWriter
that, when fed an inputByteBuffer
, returns a continuation that writes the base-16 (hexadecimal) encoding of the input byte buffer. -
byteBufferWriter
Returns aWriter
continuation that writes the base-16 (hexadecimal) encoding of theinput
byte buffer. -
writeByteArray
Writes the base-16 (hexadecimal) encoding of theinput
byte array to theoutput
, returning aWriter
continuation that knows how to write any remaining output that couldn't be immediately generated. -
writeByteBuffer
Writes the base-16 (hexadecimal) encoding of theinput
byte buffer to theoutput
, returning aWriter
continuation that knows how to write any remaining output that couldn't be immediately generated. -
writeInt
-
writeInt
-
writeLong
-
writeLong
-
writeIntLiteral
-
writeIntLiteral
-
writeLongLiteral
-
writeLongLiteral
-
lowercase
Returns theBase16
encoding with lowercase alphanumeric digits. -
uppercase
Returns theBase16
encoding with uppercase alphanumeric digits. -
parser
Returns aParser
that decodes base-16 (hexadecimal) encoded input, and writes the decoded bytes tooutput
. -
parse
Parses the base-16 (hexadecimal) encodedinput
, and writes the decoded bytes tooutput
, returning aParser
continuation that knows how to parse any additional input. -
parseByteArray
Parses the base-16 (hexadecimal) encodedinput
, and writes the decoded bytes to a growable array, returning aParser
continuation that knows how to parse any additional input. The returnedParser
binds
abyte[]
array containing all parsed base-16 data. -
parseByteBuffer
Parses the base-16 (hexadecimal) encodedinput
, and writes the decoded bytes to a growable buffer, returning aParser
continuation that knows how to parse any additional input. The returnedParser
binds
aByteBuffer
containing all parsed base-16 data. -
isDigit
public static boolean isDigit(int c) Returnstrue
if the Unicode code pointc
is a valid base-16 digit. -
decodeDigit
public static int decodeDigit(int c) Returns the 4-bit quantity represented by the base-16 digitc
.- Throws:
IllegalArgumentException
- ifc
is not a valid base-16 digit.
-
writeQuantum
s Decodes the base-16 digitsc1
andc2
, and writes the 8-bit quantity they represent to the givenoutput
.- Returns:
- the continuation of the
output
.
-