| Modifier and Type | Class and Description |
|---|---|
| public static enum | Base64Variant.
Defines how the Base64Variant deals with Padding while reading |
| Modifier and Type | Field and Description |
|---|---|
| private final transient int[] | _asciiToBase64
Decoding table used for base 64 decoding. |
| private final transient byte[] | _base64ToAsciiB
Alternative encoding table used for base 64 decoding when output is done as ascii bytes. |
| private final transient char[] | _base64ToAsciiC
Encoding table used for base 64 decoding when output is done as characters. |
| private final int | _maxLineLength
Maximum number of encoded base64 characters to output during encoding
before adding a linefeed, if line length is to be limited
( |
| pack-priv final String | _name
Symbolic name of variant; used for diagnostics/debugging. |
| private final char | _paddingChar
Character used for padding, if any ( |
| private final Base64Variant. | _paddingReadBehaviour
Whether padding characters should be required or not while decoding |
| private final boolean | _writePadding
Whether this variant uses padding when writing out content or not. |
| public static final int | BASE64_VALUE_INVALID
Marker used to denote ascii characters that do not correspond to a 6-bit value (in this variant), and is not used as a padding character. |
| public static final int | BASE64_VALUE_PADDING
Marker used to denote ascii character (in decoding table) that is the padding character using this variant (if any). |
| private static final int | |
| protected static final char | PADDING_CHAR_NONE
Placeholder used by "no padding" variant, to be used when a character value is needed. |
| private static final long |
| Access | Constructor and Description |
|---|---|
| public | Base64Variant(String name, String base64Alphabet, boolean writePadding, char paddingChar, int maxLineLength)
|
| public | Base64Variant(Base64Variant
Variant to use for settings not specific by other parameters base, String Name of this variant name, int Maximum length (in characters) of lines to output before
using linefeed maxLineLength)"Copy constructor" that can be used when the base alphabet is identical to one used by another variant except for the maximum line length (and obviously, name). |
| public | Base64Variant(Base64Variant
Variant to use for settings not specific by other parameters base, String Name of this variant name, boolean Whether variant will use padding when encoding writePadding, char Padding character used for encoding, excepted on reading, if any paddingChar, int Maximum length (in characters) of lines to output before
using linefeed maxLineLength)"Copy constructor" that can be used when the base alphabet is identical to one used by another variant, but other details (padding, maximum line length) differ |
| private | Base64Variant(Base64Variant base, String name, boolean writePadding, char paddingChar, Base64Variant.
|
| private |
| Modifier and Type | Method and Description |
|---|---|
| protected void | |
| protected void | |
| protected void | _reportInvalidBase64(char
Character to report on ch, int Relative index within base64 character unit; between 0
and 3 (as unit has exactly 4 characters) bindex, String Base message to use for exception msg)
|
| public boolean | Returns: True if this variant accepts padding on content decoded; false if not.
|
| public byte[] | |
| public void | decode(String
Input to decode str, ByteArrayBuilder Builder used for assembling decoded content builder)Convenience method for decoding contents of a Base64-encoded String,
using this variant's settings
and appending decoded binary data using provided |
| public int | |
| public int | |
| public int | |
| public String | Returns: Base64 encoded String of encodedinput bytes, not surrounded by quotesByte array to encode input)Convenience method for converting given byte array as base64 encoded String using this variant's settings. |
| public String | Returns: Base64 encoded String of encodedinput bytes, possibly
surrounded by quotes (if addQuotes enabled)Byte array to encode input, boolean Whether to surround resulting value in double quotes or not addQuotes)Convenience method for converting given byte array as base64 encoded String using this variant's settings, optionally enclosed in double-quotes. |
| public String | Returns: Base64 encoded String of encodedinput bytesByte array to encode input, boolean Whether to surround resulting value in double quotes or not addQuotes, String Linefeed to use for encoded content linefeed)Convenience method for converting given byte array as base64 encoded String using this variant's settings, optionally enclosed in double-quotes. |
| public byte | |
| public char | |
| public int | Returns: Pointer in output buffer after appending 4 encoded characters3-byte value to encode b24, char[] Output buffer to append characters to buffer, int Starting position within outPtr)buffer to append encoded charactersMethod that encodes given right-aligned (LSB) 24-bit value into 4 base64 characters, stored in given result buffer. |
| public void | |
| public int | Returns: Pointer in output buffer after appending 4 encoded characters3-byte value to encode b24, byte[] Output buffer to append characters (as bytes) to buffer, int Starting position within outPtr)buffer to append encoded charactersMethod that encodes given right-aligned (LSB) 24-bit value into 4 base64 bytes (ascii), stored in given result buffer. |
| public int | Returns: Pointer in output buffer after appending encoded characters (2, 3 or 4)24-bit chunk containing 1 or 2 bytes to encode bits, int Number of input bytes to encode (either 1 or 2) outputBytes, char[] Output buffer to append characters to buffer, int Starting position within outPtr)buffer to append encoded charactersMethod that outputs partial chunk (which only encodes one or two bytes of data). |
| public void | |
| public int | Returns: Pointer in output buffer after appending encoded characters (2, 3 or 4)24-bit chunk containing 1 or 2 bytes to encode bits, int Number of input bytes to encode (either 1 or 2) outputBytes, byte[] Output buffer to append characters to buffer, int Starting position within outPtr)buffer to append encoded charactersMethod that outputs partial chunk (which only encodes one or two bytes of data). |
| public boolean | equals(Object
the reference object with which to compare. o)Overrides java. Indicates whether some other object is "equal to" this one. |
| public int | |
| public String | |
| public byte | |
| public char | |
| public int | |
| public String | Returns: Exception message for indicating "missing padding" caseHelper method that will construct a message to use in exceptions for cases where input ends prematurely in place where padding would be expected. |
| public Base64Variant. | Returns: Indicator on how this Base64 encoding will handle possible padding in content when reading.
|
| protected Object | |
| public boolean | Returns: True if this variant requires padding on content decoded; false if not.
|
| public String | |
| protected String | Returns: Exception message for indicating "unexpected padding" caseHelper method that will construct a message to use in exceptions for cases where input ends prematurely in place where padding is not expected. |
| public boolean | Returns: True if this Base64 encoding will write padding on output (note: before Jackson 2.12 also dictated whether padding was accepted on read)
|
| public boolean | |
| public boolean | |
| public Base64Variant | |
| public Base64Variant | |
| public Base64Variant | |
| public Base64Variant | Returns: Instance with desired padding read behavior setting (this if already has setting; new instance otherwise)Padding read behavior desired readPadding
|
| public Base64Variant | Returns: Base64Variant which writes padding or not depending on writePaddingDetermines if padding is output on write or not writePadding)
|
| _asciiToBase64 | back to summary |
|---|---|
| private final transient int[] _asciiToBase64 Decoding table used for base 64 decoding. | |
| _base64ToAsciiB | back to summary |
|---|---|
| private final transient byte[] _base64ToAsciiB Alternative encoding table used for base 64 decoding when output is done as ascii bytes. | |
| _base64ToAsciiC | back to summary |
|---|---|
| private final transient char[] _base64ToAsciiC Encoding table used for base 64 decoding when output is done as characters. | |
| _maxLineLength | back to summary |
|---|---|
| private final int _maxLineLength Maximum number of encoded base64 characters to output during encoding
before adding a linefeed, if line length is to be limited
( Note for some output modes (when writing attributes) linefeeds may need to be avoided, and this value ignored. | |
| _name | back to summary |
|---|---|
| pack-priv final String _name Symbolic name of variant; used for diagnostics/debugging. Note that this is the only non-transient field; used when reading back from serialized state. Also: must not be private, accessed from `BaseVariants` | |
| _paddingChar | back to summary |
|---|---|
| private final char _paddingChar Character used for padding, if any ( | |
| _paddingReadBehaviour | back to summary |
|---|---|
| private final Base64Variant. Whether padding characters should be required or not while decoding
| |
| _writePadding | back to summary |
|---|---|
| private final boolean _writePadding Whether this variant uses padding when writing out content or not.
| |
| BASE64_VALUE_INVALID | back to summary |
|---|---|
| public static final int BASE64_VALUE_INVALID Marker used to denote ascii characters that do not correspond to a 6-bit value (in this variant), and is not used as a padding character. | |
| BASE64_VALUE_PADDING | back to summary |
|---|---|
| public static final int BASE64_VALUE_PADDING Marker used to denote ascii character (in decoding table) that is the padding character using this variant (if any). | |
| INT_SPACE | back to summary |
|---|---|
| private static final int INT_SPACE | |
| PADDING_CHAR_NONE | back to summary |
|---|---|
| protected static final char PADDING_CHAR_NONE Placeholder used by "no padding" variant, to be used when a character value is needed. | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| Base64Variant | back to summary |
|---|---|
| public Base64Variant(String name, String base64Alphabet, boolean writePadding, char paddingChar, int maxLineLength) | |
| Base64Variant | back to summary |
|---|---|
| public Base64Variant(Base64Variant base, String name, int maxLineLength) "Copy constructor" that can be used when the base alphabet is identical to one used by another variant except for the maximum line length (and obviously, name).
| |
| Base64Variant | back to summary |
|---|---|
| public Base64Variant(Base64Variant base, String name, boolean writePadding, char paddingChar, int maxLineLength) "Copy constructor" that can be used when the base alphabet is identical to one used by another variant, but other details (padding, maximum line length) differ
| |
| Base64Variant | back to summary |
|---|---|
| private Base64Variant(Base64Variant base, String name, boolean writePadding, char paddingChar, Base64Variant. | |
| Base64Variant | back to summary |
|---|---|
| private Base64Variant(Base64Variant base, Base64Variant. | |
| _reportBase64EOF | back to summary |
|---|---|
| protected void _reportBase64EOF() throws IllegalArgumentException | |
| _reportBase64UnexpectedPadding | back to summary |
|---|---|
| protected void _reportBase64UnexpectedPadding() throws IllegalArgumentException | |
| _reportInvalidBase64 | back to summary |
|---|---|
protected void _reportInvalidBase64(char ch, int bindex, String msg) throws IllegalArgumentException
| |
| acceptsPaddingOnRead | back to summary |
|---|---|
public boolean acceptsPaddingOnRead()
| |
| decode | back to summary |
|---|---|
| public byte[] decode(String input) throws IllegalArgumentException Convenience method for decoding contents of a Base64-encoded String, using this variant's settings.
| |
| decode | back to summary |
|---|---|
| public void decode(String str, ByteArrayBuilder builder) throws IllegalArgumentException Convenience method for decoding contents of a Base64-encoded String,
using this variant's settings
and appending decoded binary data using provided Note builder will NOT be reset before decoding (nor cleared afterwards); assumption is that caller will ensure it is given in proper state, and used as appropriate afterwards.
| |
| decodeBase64Byte | back to summary |
|---|---|
| public int decodeBase64Byte(byte b) | |
| decodeBase64Char | back to summary |
|---|---|
public int decodeBase64Char(char c)
| |
| decodeBase64Char | back to summary |
|---|---|
| public int decodeBase64Char(int ch) | |
| encode | back to summary |
|---|---|
| public String encode(byte[] input) Convenience method for converting given byte array as base64 encoded String using this variant's settings. Resulting value is "raw", that is, not enclosed in double-quotes.
| |
| encode | back to summary |
|---|---|
| public String encode(byte[] input, boolean addQuotes) Convenience method for converting given byte array as base64 encoded String using this variant's settings, optionally enclosed in double-quotes. Linefeeds added, if needed, are expressed as 2-character JSON (and Java source) escape sequence of backslash + `n`.
| |
| encode | back to summary |
|---|---|
| public String encode(byte[] input, boolean addQuotes, String linefeed) Convenience method for converting given byte array as base64 encoded String using this variant's settings, optionally enclosed in double-quotes. Linefeed character to use is passed explicitly. | |
| encodeBase64BitsAsByte | back to summary |
|---|---|
| public byte encodeBase64BitsAsByte(int value) | |
| encodeBase64BitsAsChar | back to summary |
|---|---|
| public char encodeBase64BitsAsChar(int value) | |
| encodeBase64Chunk | back to summary |
|---|---|
| public int encodeBase64Chunk(int b24, char[] buffer, int outPtr) Method that encodes given right-aligned (LSB) 24-bit value into 4 base64 characters, stored in given result buffer. Caller must ensure there is sufficient space for 4 encoded characters at specified position.
| |
| encodeBase64Chunk | back to summary |
|---|---|
| public void encodeBase64Chunk(StringBuilder sb, int b24) | |
| encodeBase64Chunk | back to summary |
|---|---|
| public int encodeBase64Chunk(int b24, byte[] buffer, int outPtr) Method that encodes given right-aligned (LSB) 24-bit value into 4 base64 bytes (ascii), stored in given result buffer.
| |
| encodeBase64Partial | back to summary |
|---|---|
| public int encodeBase64Partial(int bits, int outputBytes, char[] buffer, int outPtr) Method that outputs partial chunk (which only encodes one or two bytes of data). Data given is still aligned same as if it as full data; that is, missing data is at the "right end" (LSB) of int.
| |
| encodeBase64Partial | back to summary |
|---|---|
| public void encodeBase64Partial(StringBuilder sb, int bits, int outputBytes) | |
| encodeBase64Partial | back to summary |
|---|---|
| public int encodeBase64Partial(int bits, int outputBytes, byte[] buffer, int outPtr) Method that outputs partial chunk (which only encodes one or two bytes of data). Data given is still aligned same as if it as full data; that is, missing data is at the "right end" (LSB) of int.
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| getMaxLineLength | back to summary |
|---|---|
| public int getMaxLineLength() | |
| getName | back to summary |
|---|---|
| public String getName() | |
| getPaddingByte | back to summary |
|---|---|
| public byte getPaddingByte() | |
| getPaddingChar | back to summary |
|---|---|
| public char getPaddingChar() | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| missingPaddingMessage | back to summary |
|---|---|
| public String missingPaddingMessage() Helper method that will construct a message to use in exceptions for cases where input ends prematurely in place where padding would be expected.
| |
| paddingReadBehaviour | back to summary |
|---|---|
public Base64Variant.
| |
| readResolve | back to summary |
|---|---|
| protected Object readResolve() | |
| requiresPaddingOnRead | back to summary |
|---|---|
public boolean requiresPaddingOnRead()
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
| unexpectedPaddingMessage | back to summary |
|---|---|
| protected String unexpectedPaddingMessage() Helper method that will construct a message to use in exceptions for cases where input ends prematurely in place where padding is not expected.
| |
| usesPadding | back to summary |
|---|---|
public boolean usesPadding()
| |
| usesPaddingChar | back to summary |
|---|---|
| public boolean usesPaddingChar(char c) | |
| usesPaddingChar | back to summary |
|---|---|
| public boolean usesPaddingChar(int ch) | |
| withPaddingAllowed | back to summary |
|---|---|
public Base64Variant withPaddingAllowed()
| |
| withPaddingForbidden | back to summary |
|---|---|
public Base64Variant withPaddingForbidden()
| |
| withPaddingRequired | back to summary |
|---|---|
public Base64Variant withPaddingRequired()
| |
| withReadPadding | back to summary |
|---|---|
public Base64Variant withReadPadding(Base64Variant.
| |
| withWritePadding | back to summary |
|---|---|
public Base64Variant withWritePadding(boolean writePadding)
| |
| Modifier and Type | Field and Description |
|---|---|
| public static final Base64Variant. | PADDING_ALLOWED
Padding is allowed but not required in Base64 content being read: no exception thrown based on existence or absence, as long as proper padding characters are used. |
| public static final Base64Variant. | PADDING_FORBIDDEN
Padding is not allowed in Base64 content being read (finding something that looks like padding at the end of content results in an exception) |
| public static final Base64Variant. | PADDING_REQUIRED
Padding is required in Base64 content being read (missing padding for incomplete ending quartet results in an exception) |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static Base64Variant. | |
| public static Base64Variant. |
| PADDING_ALLOWED | back to summary |
|---|---|
| public static final Base64Variant. Padding is allowed but not required in Base64 content being read: no exception thrown based on existence or absence, as long as proper padding characters are used. | |
| PADDING_FORBIDDEN | back to summary |
|---|---|
| public static final Base64Variant. Padding is not allowed in Base64 content being read (finding something that looks like padding at the end of content results in an exception) | |
| PADDING_REQUIRED | back to summary |
|---|---|
| public static final Base64Variant. Padding is required in Base64 content being read (missing padding for incomplete ending quartet results in an exception) | |
| PaddingReadBehaviour | back to summary |
|---|---|
| private PaddingReadBehaviour() | |
| valueOf | back to summary |
|---|---|
| public static Base64Variant. | |
| values | back to summary |
|---|---|
| public static Base64Variant. | |