Package arc.util.serialization
Class Base64Coder
java.lang.Object
arc.util.serialization.Base64Coder
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Base64Coder.CharMap
static final Base64Coder.CharMap
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
decode
(char[] in) Decodes a byte array from Base64 format.static byte[]
decode
(char[] in, byte[] inverseCharMap) static byte[]
decode
(char[] in, int iOff, int iLen, byte[] inverseCharMap) Decodes a byte array from Base64 format.static byte[]
decode
(char[] in, int iOff, int iLen, Base64Coder.CharMap inverseCharMap) static byte[]
decode
(char[] in, Base64Coder.CharMap inverseCharMap) static byte[]
Decodes a byte array from Base64 format.static byte[]
decode
(String s, Base64Coder.CharMap inverseCharMap) Decodes a byte array from Base64 format.static byte[]
static byte[]
decodeLines
(String s, byte[] inverseCharMap) Decodes a byte array from Base64 format and ignores line separators, tabs and blanks.static byte[]
decodeLines
(String s, Base64Coder.CharMap inverseCharMap) static String
Decodes a string from Base64 format.static String
decodeString
(String s, boolean useUrlSafeEncoding) static char[]
encode
(byte[] in) Encodes a byte array into Base64 format.static char[]
encode
(byte[] in, char[] charMap) static char[]
encode
(byte[] in, int iLen) Encodes a byte array into Base64 format.static char[]
encode
(byte[] in, int iOff, int iLen, char[] charMap) Encodes a byte array into Base64 format.static char[]
encode
(byte[] in, int iOff, int iLen, Base64Coder.CharMap charMap) static char[]
encode
(byte[] in, Base64Coder.CharMap charMap) static String
encodeLines
(byte[] in) Encodes a byte array into Base64 format and breaks the output into lines of 76 characters.static String
encodeLines
(byte[] in, int iOff, int iLen, int lineLen, String lineSeparator, char[] charMap) Encodes a byte array into Base64 format and breaks the output into lines.static String
encodeLines
(byte[] in, int iOff, int iLen, int lineLen, String lineSeparator, Base64Coder.CharMap charMap) static String
Encodes a string into Base64 format.static String
encodeString
(String s, boolean useUrlsafeEncoding)
-
Field Details
-
regularMap
-
urlsafeMap
-
-
Method Details
-
encodeString
Encodes a string into Base64 format. No blanks or line breaks are inserted.- Parameters:
s
- A String to be encoded.- Returns:
- A String containing the Base64 encoded data.
-
encodeString
-
encodeLines
Encodes a byte array into Base64 format and breaks the output into lines of 76 characters. This method is compatible withsun.misc.BASE64Encoder.encodeBuffer(byte[])
.- Parameters:
in
- An array containing the data bytes to be encoded.- Returns:
- A String containing the Base64 encoded data, broken into lines.
-
encodeLines
public static String encodeLines(byte[] in, int iOff, int iLen, int lineLen, String lineSeparator, Base64Coder.CharMap charMap) -
encodeLines
public static String encodeLines(byte[] in, int iOff, int iLen, int lineLen, String lineSeparator, char[] charMap) Encodes a byte array into Base64 format and breaks the output into lines.- Parameters:
in
- An array containing the data bytes to be encoded.iOff
- Offset of the first byte inin
to be processed.iLen
- Number of bytes to be processed inin
, starting atiOff
.lineLen
- Line length for the output data. Should be a multiple of 4.lineSeparator
- The line separator to be used to separate the output lines.charMap
- char map to use- Returns:
- A String containing the Base64 encoded data, broken into lines.
-
encode
public static char[] encode(byte[] in) Encodes a byte array into Base64 format. No blanks or line breaks are inserted in the output.- Parameters:
in
- An array containing the data bytes to be encoded.- Returns:
- A character array containing the Base64 encoded data.
-
encode
-
encode
public static char[] encode(byte[] in, char[] charMap) -
encode
public static char[] encode(byte[] in, int iLen) Encodes a byte array into Base64 format. No blanks or line breaks are inserted in the output.- Parameters:
in
- An array containing the data bytes to be encoded.iLen
- Number of bytes to process inin
.- Returns:
- A character array containing the Base64 encoded data.
-
encode
-
encode
public static char[] encode(byte[] in, int iOff, int iLen, char[] charMap) Encodes a byte array into Base64 format. No blanks or line breaks are inserted in the output.- Parameters:
in
- An array containing the data bytes to be encoded.iOff
- Offset of the first byte inin
to be processed.iLen
- Number of bytes to process inin
, starting atiOff
.charMap
- char map to use- Returns:
- A character array containing the Base64 encoded data.
-
decodeString
Decodes a string from Base64 format. No blanks or line breaks are allowed within the Base64 encoded input data.- Parameters:
s
- A Base64 String to be decoded.- Returns:
- A String containing the decoded data.
- Throws:
IllegalArgumentException
- If the input is not valid Base64 encoded data.
-
decodeString
-
decodeLines
-
decodeLines
-
decodeLines
Decodes a byte array from Base64 format and ignores line separators, tabs and blanks. CR, LF, Tab and Space characters are ignored in the input data. This method is compatible withsun.misc.BASE64Decoder.decodeBuffer(String)
.- Parameters:
s
- A Base64 String to be decoded.inverseCharMap
-- Returns:
- An array containing the decoded data bytes.
- Throws:
IllegalArgumentException
- If the input is not valid Base64 encoded data.
-
decode
Decodes a byte array from Base64 format. No blanks or line breaks are allowed within the Base64 encoded input data.- Parameters:
s
- A Base64 String to be decoded.- Returns:
- An array containing the decoded data bytes.
- Throws:
IllegalArgumentException
- If the input is not valid Base64 encoded data.
-
decode
Decodes a byte array from Base64 format. No blanks or line breaks are allowed within the Base64 encoded input data.- Parameters:
s
- A Base64 String to be decoded.inverseCharMap
-- Returns:
- An array containing the decoded data bytes.
- Throws:
IllegalArgumentException
- If the input is not valid Base64 encoded data.
-
decode
public static byte[] decode(char[] in, byte[] inverseCharMap) -
decode
-
decode
public static byte[] decode(char[] in) Decodes a byte array from Base64 format. No blanks or line breaks are allowed within the Base64 encoded input data.- Parameters:
in
- A character array containing the Base64 encoded data.- Returns:
- An array containing the decoded data bytes.
- Throws:
IllegalArgumentException
- If the input is not valid Base64 encoded data.
-
decode
-
decode
public static byte[] decode(char[] in, int iOff, int iLen, byte[] inverseCharMap) Decodes a byte array from Base64 format. No blanks or line breaks are allowed within the Base64 encoded input data.- Parameters:
in
- A character array containing the Base64 encoded data.iOff
- Offset of the first character inin
to be processed.iLen
- Number of characters to process inin
, starting atiOff
.inverseCharMap
- charMap to use- Returns:
- An array containing the decoded data bytes.
- Throws:
IllegalArgumentException
- If the input is not valid Base64 encoded data.
-