Package com.google.gwt.user.server
Class Base64Utils
java.lang.Object
com.google.gwt.user.server.Base64Utils
A utility to decode and encode byte arrays as Strings, using only "safe"
characters.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
fromBase64
(String data) Decode a base64 string into a byte array.static long
longFromBase64
(String value) Decode a base64 string into a long value.static String
toBase64
(byte[] data) Converts a byte array into a base 64 encoded string.static String
toBase64
(long value) Return a string containing a base-64 encoded version of the given long value.
-
Constructor Details
-
Base64Utils
public Base64Utils()
-
-
Method Details
-
fromBase64
Decode a base64 string into a byte array.- Parameters:
data
- the encoded data.- Returns:
- a byte array.
- See Also:
-
longFromBase64
Decode a base64 string into a long value. -
toBase64
Converts a byte array into a base 64 encoded string. Null is encoded as null, and an empty array is encoded as an empty string. Otherwise, the byte data is read 3 bytes at a time, with bytes off the end of the array padded with zeros. Each 24-bit chunk is encoded as 4 characters from the sequence [A-Za-z0-9$_]. If one of the source positions consists entirely of padding zeros, an '=' character is used instead.- Parameters:
data
- a byte array, which may be null or empty- Returns:
- a String
-
toBase64
Return a string containing a base-64 encoded version of the given long value. Leading groups of all zero bits are omitted.
-