Package com.google.gwt.user.server
Class Base64Utils
- java.lang.Object
-
- com.google.gwt.user.server.Base64Utils
-
public class Base64Utils extends java.lang.Object
A utility to decode and encode byte arrays as Strings, using only "safe" characters.
-
-
Constructor Summary
Constructors Constructor Description Base64Utils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]
fromBase64(java.lang.String data)
Decode a base64 string into a byte array.static long
longFromBase64(java.lang.String value)
Decode a base64 string into a long value.static java.lang.String
toBase64(byte[] data)
Converts a byte array into a base 64 encoded string.static java.lang.String
toBase64(long value)
Return a string containing a base-64 encoded version of the given long value.
-
-
-
Method Detail
-
fromBase64
public static byte[] fromBase64(java.lang.String data)
Decode a base64 string into a byte array.- Parameters:
data
- the encoded data.- Returns:
- a byte array.
- See Also:
fromBase64(String)
-
longFromBase64
public static long longFromBase64(java.lang.String value)
Decode a base64 string into a long value.
-
toBase64
public static java.lang.String toBase64(byte[] data)
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
public static java.lang.String toBase64(long value)
Return a string containing a base-64 encoded version of the given long value. Leading groups of all zero bits are omitted.
-
-