public final class Base64Variant
extends java.lang.Object
Implementation notes:
Modifier and Type | Field and Description |
---|---|
private int[] |
_asciiToBase64
Decoding table used for base 64 decoding.
|
private byte[] |
_base64ToAsciiB
Alternative encoding table used for base 64 decoding when output is done
as ascii bytes.
|
private char[] |
_base64ToAsciiC
Encoding table used for base 64 decoding when output is done
as characters.
|
(package private) int |
_maxLineLength
Maximum number of encoded base64 characters to output during encoding
before adding a linefeed, if line length is to be limited
(
Integer.MAX_VALUE if not limited). |
(package private) java.lang.String |
_name
Symbolic name of variant; used for diagnostics/debugging.
|
(package private) char |
_paddingChar
Characted used for padding, if any (
PADDING_CHAR_NONE if not). |
(package private) boolean |
_usesPadding
Whether this variant uses padding or not.
|
static 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.
|
static int |
BASE64_VALUE_PADDING
Marker used to denote ascii character (in decoding table) that
is the padding character using this variant (if any).
|
(package private) static char |
PADDING_CHAR_NONE
Placeholder used by "no padding" variant, to be used when a character
value is needed.
|
Constructor and Description |
---|
Base64Variant(Base64Variant base,
java.lang.String name,
boolean usesPadding,
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(Base64Variant base,
java.lang.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(java.lang.String name,
java.lang.String base64Alphabet,
boolean usesPadding,
char paddingChar,
int maxLineLength) |
Modifier and Type | Method and Description |
---|---|
int |
decodeBase64Byte(byte b) |
int |
decodeBase64Char(char c) |
byte |
encodeBase64BitsAsByte(int value) |
char |
encodeBase64BitsAsChar(int value) |
int |
encodeBase64Chunk(int b24,
byte[] buffer,
int ptr)
Method that encodes given right-aligned (LSB) 24-bit value
into 4 base64 bytes (ascii), stored in given result buffer.
|
int |
encodeBase64Chunk(int b24,
char[] buffer,
int ptr)
Method that encodes given right-aligned (LSB) 24-bit value
into 4 base64 characters, stored in given result buffer.
|
int |
encodeBase64Partial(int bits,
int outputBytes,
byte[] buffer,
int outPtr)
Method that outputs partial chunk (which only encodes one
or two bytes of data).
|
int |
encodeBase64Partial(int bits,
int outputBytes,
char[] buffer,
int outPtr)
Method that outputs partial chunk (which only encodes one
or two bytes of data).
|
int |
getMaxLineLength() |
java.lang.String |
getName() |
byte |
getPaddingByte() |
char |
getPaddingChar() |
java.lang.String |
toString() |
boolean |
usesPadding() |
boolean |
usesPaddingChar(char c) |
static final char PADDING_CHAR_NONE
public static final int BASE64_VALUE_INVALID
public static final int BASE64_VALUE_PADDING
private final int[] _asciiToBase64
private final char[] _base64ToAsciiC
private final byte[] _base64ToAsciiB
final java.lang.String _name
final boolean _usesPadding
final char _paddingChar
PADDING_CHAR_NONE
if not).final int _maxLineLength
Integer.MAX_VALUE
if not limited).
Note: for some output modes (when writing attributes) linefeeds may need to be avoided, and this value ignored.
public Base64Variant(java.lang.String name, java.lang.String base64Alphabet, boolean usesPadding, char paddingChar, int maxLineLength)
public Base64Variant(Base64Variant base, java.lang.String name, int maxLineLength)
public Base64Variant(Base64Variant base, java.lang.String name, boolean usesPadding, char paddingChar, int maxLineLength)
public java.lang.String getName()
public boolean usesPadding()
public boolean usesPaddingChar(char c)
public char getPaddingChar()
public byte getPaddingByte()
public int getMaxLineLength()
public int decodeBase64Char(char c)
public int decodeBase64Byte(byte b)
public char encodeBase64BitsAsChar(int value)
public int encodeBase64Chunk(int b24, char[] buffer, int ptr)
public int encodeBase64Partial(int bits, int outputBytes, char[] buffer, int outPtr)
outputBytes
- Number of encoded bytes included (either 1 or 2)public byte encodeBase64BitsAsByte(int value)
public int encodeBase64Chunk(int b24, byte[] buffer, int ptr)
public int encodeBase64Partial(int bits, int outputBytes, byte[] buffer, int outPtr)
outputBytes
- Number of encoded bytes included (either 1 or 2)public java.lang.String toString()
toString
in class java.lang.Object