public class Base64
extends java.lang.Object
NOTE! This is modified Base64 with slightly different characters than usual, so it won't require escaping when used in URLs.
NOTE! This class only does the padding that's normal in Base64 if the 'true' flag is given to the encode() method. This is because Base64 requires that the length of the encoded text be a multiple of four characters, padded with '='. Without the 'true' flag, we don't add these '=' characters.
Constructor and Description |
---|
Base64() |
Modifier and Type | Method and Description |
---|---|
static byte[] |
decode(java.lang.String inStr)
Handles the standards-compliant padding (padded with '=' signs) as well as our
shortened form.
|
static byte[] |
decodeStandard(java.lang.String inStr)
Handles the standards-compliant base64 encoding.
|
static java.lang.String |
decodeUTF8(java.lang.String inStr)
Convenience method to decode into a string, in our shortened format.
|
static java.lang.String |
encode(byte[] in)
Encode to our shortened (non-standards-compliant) format.
|
static java.lang.String |
encode(byte[] in,
boolean equalsPad)
Caller should specify equalsPad=true if they want a standards compliant padding,
but not standard compliant encoding.
|
static java.lang.String |
encodeStandard(byte[] in)
Standard compliant encoding.
|
static java.lang.String |
encodeStandardUTF8(java.lang.String in)
Convenience method to encode a string.
|
static java.lang.String |
encodeUTF8(java.lang.String in)
Convenience method to encode a string, in our shortened format.
|
static java.lang.String |
encodeUTF8(java.lang.String in,
boolean equalsPad)
Convenience method to encode a string.
|
public static java.lang.String encode(byte[] in)
public static java.lang.String encode(byte[] in, boolean equalsPad)
public static java.lang.String encodeUTF8(java.lang.String in)
public static java.lang.String encodeUTF8(java.lang.String in, boolean equalsPad)
public static java.lang.String encodeStandardUTF8(java.lang.String in)
public static java.lang.String encodeStandard(byte[] in)
public static byte[] decode(java.lang.String inStr) throws IllegalBase64Exception
IllegalBase64Exception
public static java.lang.String decodeUTF8(java.lang.String inStr) throws IllegalBase64Exception
IllegalBase64Exception
public static byte[] decodeStandard(java.lang.String inStr) throws IllegalBase64Exception
IllegalBase64Exception