|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.portal.common.util.Base64
Encodes and decodes to and from Base64 and URL-safe Base64 encodings. URL-safe Base64 encoding being defined here as standard Base64 encoding with the following modifications:
Based on version 2.1 of the Base64 class developed by Robert Harder (public domain). Please visit http://iharder.net/base64 periodically to check for updates or to contribute improvements.
Method Summary | |
static byte[] |
decode(byte[] source,
int off,
int len,
boolean urlSafeEncodingWasUsed)
Very low-level access to decoding ASCII characters in the form of a byte array. |
static byte[] |
decode(java.lang.String s)
Decodes data from Base64 notation |
static byte[] |
decode(java.lang.String s,
boolean urlSafeEncodingWasUsed)
Decodes data from Base64 notation |
static java.lang.String |
encodeBytes(byte[] source)
Encodes a byte array into Base64 notation using the standard Base64 encoding. |
static java.lang.String |
encodeBytes(byte[] source,
boolean useURLSafeEncoding)
Encodes a byte array into Base64 notation. |
static java.lang.String |
encodeBytes(byte[] source,
int off,
int len,
boolean useURLSafeEncoding)
Encodes a byte array into Base64 notation. |
void |
initAlphabets(boolean useURLSafeEncoding)
Determine which ALPHABET to use. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public void initAlphabets(boolean useURLSafeEncoding)
public static java.lang.String encodeBytes(byte[] source)
source
- The data to convertpublic static java.lang.String encodeBytes(byte[] source, boolean useURLSafeEncoding)
source
- The data to convertuseURLSafeEncoding
- true
to use '-', '_' instead of '+', '/' in the alphabet and '*' instead
of '=' for padding to generate a URL-safe encoding. Note: Technically, this makes
your encoding non-compliant.public static java.lang.String encodeBytes(byte[] source, int off, int len, boolean useURLSafeEncoding)
source
- The data to convertoff
- Offset in array where conversion should beginlen
- Length of data to convertuseURLSafeEncoding
- true
to use '-', '_' instead of '+', '/' in the alphabet and '*' instead
of '=' for padding to generate a URL-safe encoding. Note: Technically, this makes
your encoding non-compliant.public static byte[] decode(byte[] source, int off, int len, boolean urlSafeEncodingWasUsed)
source
- The Base64 encoded dataoff
- The offset of where to begin decodinglen
- The length of characters to decodeurlSafeEncodingWasUsed
- true
if the URL-safe was used to encode the data to be decoded
public static byte[] decode(java.lang.String s, boolean urlSafeEncodingWasUsed)
s
- the string to decodeurlSafeEncodingWasUsed
- true
if the URL-safe was used to encode the data to be decoded
public static byte[] decode(java.lang.String s)
s
- the string to decode
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |