|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.portal.common.util.Base64
public class 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.
Nested Class Summary | |
---|---|
static class |
Base64.EncodingOption
|
Method Summary | |
---|---|
static byte[] |
decode(byte[] source,
int off,
int len,
Base64.EncodingOption optionThatWasUsed)
Very low-level access to decoding ASCII characters in the form of a byte array. |
static byte[] |
decode(byte[] source,
int off,
int len,
boolean urlSafeEncodingWasUsed)
Deprecated. |
static byte[] |
decode(java.lang.String s)
Decodes data from Base64 notation |
static byte[] |
decode(java.lang.String s,
Base64.EncodingOption optionThatWasUsed)
Decodes data from Base64 notation |
static byte[] |
decode(java.lang.String s,
boolean urlSafeEncodingWasUsed)
Deprecated. |
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,
Base64.EncodingOption option)
Encodes a byte array into Base64 notation. |
static java.lang.String |
encodeBytes(byte[] source,
boolean useURLSafeEncoding)
Deprecated. |
static java.lang.String |
encodeBytes(byte[] source,
int off,
int len,
Base64.EncodingOption option)
Encodes a byte array into Base64 notation. |
static java.lang.String |
encodeBytes(byte[] source,
int off,
int len,
boolean useURLSafeEncoding)
Deprecated. |
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, Base64.EncodingOption option)
source
- The data to convertoption
- Encoding optionpublic static java.lang.String encodeBytes(byte[] source, int off, int len, Base64.EncodingOption option)
source
- The data to convertoff
- Offset in array where conversion should beginlen
- Length of data to convertoption
- Encoding optionpublic static byte[] decode(byte[] source, int off, int len, Base64.EncodingOption optionThatWasUsed)
source
- The Base64 encoded dataoff
- The offset of where to begin decodinglen
- The length of characters to decodeoptionThatWasUsed
- EncodingOption used during the encoding
public static byte[] decode(java.lang.String s, Base64.EncodingOption optionThatWasUsed)
s
- the string to decodeurlSafeEncodingWasUsed
- true
if the URL-safe was used to encode the data to be decodedoptionThatWasUsed
- EncodingOption used during the encoding
public static byte[] decode(java.lang.String s)
s
- the string to decode
public 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
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |