APIdia Launch Partner
Top Inners Fields Constructors Methods
com.badlogic.gdx.utils

public Class Base64Coder

extends Object
Class Inheritance
Imports
java.io.UnsupportedEncodingException

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
public static final Base64Coder.CharMap
private static final String
public static final Base64Coder.CharMap

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static byte[]

Returns:

An array containing the decoded data bytes.
decode
(String
A Base64 String to be decoded.
s
)

Decodes a byte array from Base64 format.

public static byte[]

Returns:

An array containing the decoded data bytes.
decode
(String
A Base64 String to be decoded.
s
,
Base64Coder.CharMap inverseCharMap)

Decodes a byte array from Base64 format.

public static byte[]
decode(char[] in, byte[] inverseCharMap)

public static byte[]
decode(char[] in, Base64Coder.CharMap inverseCharMap)

public static byte[]

Returns:

An array containing the decoded data bytes.
decode
(char[]
A character array containing the Base64 encoded data.
in
)

Decodes a byte array from Base64 format.

public static byte[]
decode(char[] in, int iOff, int iLen, Base64Coder.CharMap inverseCharMap)

public static byte[]

Returns:

An array containing the decoded data bytes.
decode
(char[]
A character array containing the Base64 encoded data.
in
,
int
Offset of the first character in in to be processed.
iOff
,
int
Number of characters to process in in, starting at iOff.
iLen
,
byte[]
charMap to use
inverseCharMap
)

Decodes a byte array from Base64 format.

public static byte[]
public static byte[]
public static byte[]

Returns:

An array containing the decoded data bytes.
decodeLines
(String
A Base64 String to be decoded.
s
,
byte[] inverseCharMap)

Decodes a byte array from Base64 format and ignores line separators, tabs and blanks.

public static String

Returns:

A String containing the decoded data.
decodeString
(String
A Base64 String to be decoded.
s
)

Decodes a string from Base64 format.

public static String
decodeString(String s, boolean useUrlSafeEncoding)

public static char[]

Returns:

A character array containing the Base64 encoded data.
encode
(byte[]
An array containing the data bytes to be encoded.
in
)

Encodes a byte array into Base64 format.

public static char[]
encode(byte[] in, Base64Coder.CharMap charMap)

public static char[]
encode(byte[] in, char[] charMap)

public static char[]

Returns:

A character array containing the Base64 encoded data.
encode
(byte[]
An array containing the data bytes to be encoded.
in
,
int
Number of bytes to process in in.
iLen
)

Encodes a byte array into Base64 format.

public static char[]
encode(byte[] in, int iOff, int iLen, Base64Coder.CharMap charMap)

public static char[]

Returns:

A character array containing the Base64 encoded data.
encode
(byte[]
An array containing the data bytes to be encoded.
in
,
int
Offset of the first byte in in to be processed.
iOff
,
int
Number of bytes to process in in, starting at iOff.
iLen
,
char[]
char map to use
charMap
)

Encodes a byte array into Base64 format.

public static String

Returns:

A String containing the Base64 encoded data, broken into lines.
encodeLines
(byte[]
An array containing the data bytes to be encoded.
in
)

Encodes a byte array into Base64 format and breaks the output into lines of 76 characters.

public static String
encodeLines(byte[] in, int iOff, int iLen, int lineLen, String lineSeparator, Base64Coder.CharMap charMap)

public static String

Returns:

A String containing the Base64 encoded data, broken into lines.
encodeLines
(byte[]
An array containing the data bytes to be encoded.
in
,
int
Offset of the first byte in in to be processed.
iOff
,
int
Number of bytes to be processed in in, starting at iOff.
iLen
,
int
Line length for the output data. Should be a multiple of 4.
lineLen
,
String
The line separator to be used to separate the output lines.
lineSeparator
,
char[]
char map to use
charMap
)

Encodes a byte array into Base64 format and breaks the output into lines.

public static String

Returns:

A String containing the Base64 encoded data.
encodeString
(String
A String to be encoded.
s
)

Encodes a string into Base64 format.

public static String

Returns:

A String containing the Base64 encoded data.
encodeString
(String
A String to be encoded.
s
,
boolean
If true, this encodes the result with an alternate URL-safe set of characters.
useUrlsafeEncoding
)

Encodes a string into Base64 format, optionally using URL-safe encoding instead of the "regular" Base64 encoding.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

regularMapback to summary
public static final Base64Coder.CharMap regularMap
systemLineSeparatorback to summary
private static final String systemLineSeparator
urlsafeMapback to summary
public static final Base64Coder.CharMap urlsafeMap

Constructor Detail

Base64Coderback to summary
private Base64Coder()

Method Detail

decodeback to summary
public static byte[] decode(String s)

Decodes a byte array from Base64 format. No blanks or line breaks are allowed within the Base64 encoded input data.

Parameters
s:String

A Base64 String to be decoded.

Returns:byte[]

An array containing the decoded data bytes.

Exceptions
IllegalArgumentException:
If the input is not valid Base64 encoded data.
decodeback to summary
public static byte[] decode(String s, Base64Coder.CharMap inverseCharMap)

Decodes a byte array from Base64 format. No blanks or line breaks are allowed within the Base64 encoded input data.

Parameters
s:String

A Base64 String to be decoded.

Returns:byte[]

An array containing the decoded data bytes.

Exceptions
IllegalArgumentException:
If the input is not valid Base64 encoded data.
decodeback to summary
public static byte[] decode(char[] in, byte[] inverseCharMap)
decodeback to summary
public static byte[] decode(char[] in, Base64Coder.CharMap inverseCharMap)
decodeback to summary
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:char[]

A character array containing the Base64 encoded data.

Returns:byte[]

An array containing the decoded data bytes.

Exceptions
IllegalArgumentException:
If the input is not valid Base64 encoded data.
decodeback to summary
public static byte[] decode(char[] in, int iOff, int iLen, Base64Coder.CharMap inverseCharMap)
decodeback to summary
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:char[]

A character array containing the Base64 encoded data.

iOff:int

Offset of the first character in in to be processed.

iLen:int

Number of characters to process in in, starting at iOff.

inverseCharMap:byte[]

charMap to use

Returns:byte[]

An array containing the decoded data bytes.

Exceptions
IllegalArgumentException:
If the input is not valid Base64 encoded data.
decodeLinesback to summary
public static byte[] decodeLines(String s)
decodeLinesback to summary
public static byte[] decodeLines(String s, Base64Coder.CharMap inverseCharMap)
decodeLinesback to summary
public static byte[] decodeLines(String s, byte[] inverseCharMap)

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 with sun.misc.BASE64Decoder.decodeBuffer(String).

Parameters
s:String

A Base64 String to be decoded.

Returns:byte[]

An array containing the decoded data bytes.

Exceptions
IllegalArgumentException:
If the input is not valid Base64 encoded data.
decodeStringback to summary
public static String decodeString(String s)

Decodes a string from Base64 format. No blanks or line breaks are allowed within the Base64 encoded input data.

Parameters
s:String

A Base64 String to be decoded.

Returns:String

A String containing the decoded data.

Exceptions
IllegalArgumentException:
If the input is not valid Base64 encoded data.
decodeStringback to summary
public static String decodeString(String s, boolean useUrlSafeEncoding)
encodeback to summary
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:byte[]

An array containing the data bytes to be encoded.

Returns:char[]

A character array containing the Base64 encoded data.

encodeback to summary
public static char[] encode(byte[] in, Base64Coder.CharMap charMap)
encodeback to summary
public static char[] encode(byte[] in, char[] charMap)
encodeback to summary
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:byte[]

An array containing the data bytes to be encoded.

iLen:int

Number of bytes to process in in.

Returns:char[]

A character array containing the Base64 encoded data.

encodeback to summary
public static char[] encode(byte[] in, int iOff, int iLen, Base64Coder.CharMap charMap)
encodeback to summary
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:byte[]

An array containing the data bytes to be encoded.

iOff:int

Offset of the first byte in in to be processed.

iLen:int

Number of bytes to process in in, starting at iOff.

charMap:char[]

char map to use

Returns:char[]

A character array containing the Base64 encoded data.

encodeLinesback to summary
public static String encodeLines(byte[] in)

Encodes a byte array into Base64 format and breaks the output into lines of 76 characters. This method is compatible with sun.misc.BASE64Encoder.encodeBuffer(byte[]).

Parameters
in:byte[]

An array containing the data bytes to be encoded.

Returns:String

A String containing the Base64 encoded data, broken into lines.

encodeLinesback to summary
public static String encodeLines(byte[] in, int iOff, int iLen, int lineLen, String lineSeparator, Base64Coder.CharMap charMap)
encodeLinesback to summary
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:byte[]

An array containing the data bytes to be encoded.

iOff:int

Offset of the first byte in in to be processed.

iLen:int

Number of bytes to be processed in in, starting at iOff.

lineLen:int

Line length for the output data. Should be a multiple of 4.

lineSeparator:String

The line separator to be used to separate the output lines.

charMap:char[]

char map to use

Returns:String

A String containing the Base64 encoded data, broken into lines.

encodeStringback to summary
public static String encodeString(String s)

Encodes a string into Base64 format. No blanks or line breaks are inserted.

Parameters
s:String

A String to be encoded.

Returns:String

A String containing the Base64 encoded data.

encodeStringback to summary
public static String encodeString(String s, boolean useUrlsafeEncoding)

Encodes a string into Base64 format, optionally using URL-safe encoding instead of the "regular" Base64 encoding. No blanks or line breaks are inserted.

Parameters
s:String

A String to be encoded.

useUrlsafeEncoding:boolean

If true, this encodes the result with an alternate URL-safe set of characters.

Returns:String

A String containing the Base64 encoded data.

com.badlogic.gdx.utils back to summary

public Class Base64Coder.CharMap

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
protected final byte[]
protected final char[]

Constructor Summary

AccessConstructor and Description
public
CharMap(char char63, char char64)

Method Summary

Modifier and TypeMethod and Description
public byte[]
public char[]
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

decodingMapback to summary
protected final byte[] decodingMap
encodingMapback to summary
protected final char[] encodingMap

Constructor Detail

CharMapback to summary
public CharMap(char char63, char char64)

Method Detail

getDecodingMapback to summary
public byte[] getDecodingMap()
getEncodingMapback to summary
public char[] getEncodingMap()