| Modifier and Type | Field and Description |
|---|---|
static BaseEncoding |
BASE_16
Base16 encoding scheme.
|
static BaseEncoding |
BASE_32
Base32 encoding scheme.
|
static BaseEncoding |
BASE_32_HEX
Base32 encoding scheme with extended Hex alphabet.
|
static BaseEncoding |
BASE_64
Base64 encoding scheme.
|
static BaseEncoding |
BASE_64_URL
Base64 encoding scheme with URL and filename safe alphabet.
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
decode(String in)
Decodes the given encoded
String according to this
BaseEncoding's configuration. |
byte[] |
decode(String in,
int off,
int len)
Decodes the specified range from the given encoded
String
according to this BaseEncoding's configuration. |
String |
encode(byte... in)
Encodes the given data bytes according to this
BaseEncoding's
configuration. |
String |
encode(byte[] in,
int off,
int len)
Encodes the given data bytes according to this
BaseEncoding's
configuration. |
BaseEncoding |
ignoreUnknownCharacters()
Returns a
BaseEncoding that behaves as this one except that
it ignores any unknown character when decoding encoded data. |
BaseEncoding |
withoutPadding()
Returns a
BaseEncoding that behaves as this one except that
it doesn't append padding when encoding data and treats any padding
character as an unknown character when decoding encoded data. |
BaseEncoding |
withSeparator(String separator,
int n)
Returns a
BaseEncoding that behaves as this one except that
it adds the specified separator after every n characters when
encoding data and ignores any occurence of the specified separator
when decoding encoded data. |
public static final BaseEncoding BASE_64
public static final BaseEncoding BASE_64_URL
public static final BaseEncoding BASE_32
public static final BaseEncoding BASE_32_HEX
public static final BaseEncoding BASE_16
public BaseEncoding withSeparator(String separator, int n)
BaseEncoding that behaves as this one except that
it adds the specified separator after every n characters when
encoding data and ignores any occurence of the specified separator
when decoding encoded data.
See RFC 4648
section 3.1 for more details.separator - the separator to use.n - the number of characters between two successive separators.BaseEncoding with the desired configuration.NullPointerException - if separator is null.IllegalArgumentException - if separator contains any
alphabet or padding characters or if n <= 0.public BaseEncoding withoutPadding()
BaseEncoding that behaves as this one except that
it doesn't append padding when encoding data and treats any padding
character as an unknown character when decoding encoded data. Also,
note that since Base16 encoding scheme does not need padding, it is
not affected by this method call.
See RFC 4648
section 3.2 for more details.BaseEncoding with the desired configuration.public BaseEncoding ignoreUnknownCharacters()
BaseEncoding that behaves as this one except that
it ignores any unknown character when decoding encoded data.
See RFC 4648
section 3.3 for more details.BaseEncoding with the desired configuration.public String encode(byte... in)
BaseEncoding's
configuration.in - the data bytes to encode.String.NullPointerException - if in is null.public String encode(byte[] in, int off, int len)
BaseEncoding's
configuration.in - the input buffer.off - the input offset.len - the number of bytes to encode.String.NullPointerException - if in is null.IndexOutOfBoundsException - if off or len is
negative or if off + len is greater than in's
length.public byte[] decode(String in)
String according to this
BaseEncoding's configuration. Decoding is not case-sensitive
when possible (namely for Base16, Base32 and Base32Hex schemes).in - the input String.NullPointerException - if in is null.IllegalArgumentException - if in is not a valid
base-encoded String according to this
BaseEncoding's configuration.public byte[] decode(String in, int off, int len)
String
according to this BaseEncoding's configuration. Decoding is
not case-sensitive when possible (namely for Base16, Base32 and
Base32Hex schemes).in - the input String.off - the input offset.len - the number of characters to decode.NullPointerException - if in is null.IndexOutOfBoundsException - if off or len is
negative or if off + len is greater than in's
length.IllegalArgumentException - if the specified character range in
in is not a valid base-encoded String according
to this BaseEncoding's configuration.Copyright © 2012–2015. All rights reserved.