java.lang.Object
swim.codec.Base64
-
Method Summary
Modifier and TypeMethodDescriptionabstract Stringalphabet()Returns a 64 character string, where the character at indexiis the encoding of the base-64 digiti.Writer<byte[],?> Returns aWriterthat, when fed an inputbyte[]array, returns a continuation that writes the base-64 (7-bit ASCII) encoding of the input byte array.Writer<?,byte[]> byteArrayWriter(byte[] input) Returns aWritercontinuation that writes the base-64 (7-bit ASCII) encoding of theinputbyte array.Writer<ByteBuffer,?> Returns aWriterthat, when fed an inputByteBuffer, returns a continuation that writes the base-64 (7-bit ASCII) encoding of the input byte buffer.Writer<?,ByteBuffer> byteBufferWriter(ByteBuffer input) Returns aWritercontinuation that writes the base-64 (7-bit ASCII) encoding of theinputbyte buffer.intdecodeDigit(int c) Returns the 7-bit quantity represented by the base-64 digitc.charencodeDigit(int b) Returns the Unicode code point of the base-64 digit that encodes the given 7-bit quantity.abstract booleanisDigit(int c) Returnstrueif the Unicode code pointcis a valid base-64 digit.abstract booleanisPadded()Returnstrueif this base-64 encoding requires padding.abstract Base64isPadded(boolean isPadded) Returns thisBase64encoding with required padding, ifisPaddedistrue.<O> Parser<O>Parses the base-64 (7-bit ASCII) encodedinput, and writes the decoded bytes tooutput, returning aParsercontinuation that knows how to parse any additional input.Parser<byte[]>parseByteArray(Input input) Parses the base-64 (7-bit ASCII) encodedinput, and writes the decoded bytes to a growable array, returning aParsercontinuation that knows how to parse any additional input.parseByteBuffer(Input input) Parses the base-64 (t-bit ASCII) encodedinput, and writes the decoded bytes to a growable buffer, returning aParsercontinuation that knows how to parse any additional input.<O> Parser<O>Returns aParserthat decodes base-64 (7-bit ASCII) encoded input, and writes the decoded bytes tooutput.static Base64standard()Returns theBase64encoding with the standard alphabet.static Base64standard(boolean isPadded) Returns theBase64encoding with the standard alphabet, and required padding, ifisPaddedistrue.static Base64url()Returns theBase64encoding with the url and filename safe alphabet.static Base64url(boolean isPadded) Returns theBase64encoding with the url and filename safe alphabet, and required padding, ifisPaddedistrue.static Base64Writer<?,?> writeByteArray(Output<?> output, byte[] input) Writes the base-64 (7-bit ASCII) encoding of theinputbyte array to theoutput, returning aWritercontinuation that knows how to write any remaining output that couldn't be immediately generated.Writer<?,?> writeByteBuffer(Output<?> output, ByteBuffer input) Writes the base-64 (7-bit ASCII) encoding of theinputbyte buffer to theoutput, returning aWritercontinuation that knows how to write any remaining output that couldn't be immediately generated.<T> Output<T>writeQuantum(Output<T> output, int c1, int c2, int c3, int c4) Decodes the base-64 digitsc1,c2,c3, andc4, and writes the 8 to 24 bit quantity they represent to the givenoutput.
-
Method Details
-
alphabet
Returns a 64 character string, where the character at indexiis the encoding of the base-64 digiti. -
isPadded
public abstract boolean isPadded()Returnstrueif this base-64 encoding requires padding. -
isPadded
Returns thisBase64encoding with required padding, ifisPaddedistrue. -
isDigit
public abstract boolean isDigit(int c) Returnstrueif the Unicode code pointcis a valid base-64 digit. -
decodeDigit
public int decodeDigit(int c) Returns the 7-bit quantity represented by the base-64 digitc.- Throws:
IllegalArgumentException- ifcis not a valid base-64 digit.
-
encodeDigit
public char encodeDigit(int b) Returns the Unicode code point of the base-64 digit that encodes the given 7-bit quantity. -
writeQuantum
Decodes the base-64 digitsc1,c2,c3, andc4, and writes the 8 to 24 bit quantity they represent to the givenoutput.- Returns:
- the continuation of the
output.
-
parser
Returns aParserthat decodes base-64 (7-bit ASCII) encoded input, and writes the decoded bytes tooutput. -
parse
Parses the base-64 (7-bit ASCII) encodedinput, and writes the decoded bytes tooutput, returning aParsercontinuation that knows how to parse any additional input. -
parseByteArray
Parses the base-64 (7-bit ASCII) encodedinput, and writes the decoded bytes to a growable array, returning aParsercontinuation that knows how to parse any additional input. The returnedParserbindsabyte[]array containing all parsed base-64 data. -
parseByteBuffer
Parses the base-64 (t-bit ASCII) encodedinput, and writes the decoded bytes to a growable buffer, returning aParsercontinuation that knows how to parse any additional input. The returnedParserbindsaByteBuffercontaining all parsed base-64 data. -
byteArrayWriter
Returns aWriterthat, when fed an inputbyte[]array, returns a continuation that writes the base-64 (7-bit ASCII) encoding of the input byte array. -
byteArrayWriter
Returns aWritercontinuation that writes the base-64 (7-bit ASCII) encoding of theinputbyte array. -
byteBufferWriter
Returns aWriterthat, when fed an inputByteBuffer, returns a continuation that writes the base-64 (7-bit ASCII) encoding of the input byte buffer. -
byteBufferWriter
Returns aWritercontinuation that writes the base-64 (7-bit ASCII) encoding of theinputbyte buffer. -
writeByteArray
Writes the base-64 (7-bit ASCII) encoding of theinputbyte array to theoutput, returning aWritercontinuation that knows how to write any remaining output that couldn't be immediately generated. -
writeByteBuffer
Writes the base-64 (7-bit ASCII) encoding of theinputbyte buffer to theoutput, returning aWritercontinuation that knows how to write any remaining output that couldn't be immediately generated. -
standard
Returns theBase64encoding with the standard alphabet. -
standard
Returns theBase64encoding with the standard alphabet, and required padding, ifisPaddedistrue. -
url
Returns theBase64encoding with the url and filename safe alphabet. -
urlUnpadded
-
url
Returns theBase64encoding with the url and filename safe alphabet, and required padding, ifisPaddedistrue.
-