|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ahc.util.string.Base64Formatter
This class provides methods for encoding arbitrary data (i.e. byte arrays) in Base64, a standardized format using only "printable" characters.
Constructor Summary | |
Base64Formatter()
|
Method Summary | |
static byte[] |
decode(byte[] data)
This method decodes a sequence of bytes from Base64 encoding into the original byte sequence. |
static byte[] |
decode(java.lang.String str)
This method decodes a sequence of bytes from Base64 encoding into the original byte sequence. |
static byte[] |
encode(byte[] data)
encodes the given data and returns the result in string form. |
static java.lang.String |
encodeToString(byte[] data)
encodes the given data and returns the result in string form. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Base64Formatter()
Method Detail |
public static java.lang.String encodeToString(byte[] data)
Passing in null
return null
.
Strictly speaking, the result of the encoding process is a byte array (or rather, a sequence of ASCII characters, which is basically the same) and not a string so that the string representation would depend on the encoding used. But given the nature of Base64, the string representation of the characters used is widely independent of the encoding used as long as it is a single-byte encoding. Specifically, ASCII, ISO-8859-1 and UTF-8 all yield the same results.
public static byte[] encode(byte[] data)
Passing in null
return null
.
public static final byte[] decode(java.lang.String str)
Passing in null
returns null
.
Strictly speaking, the result of the encoding process is a byte array (or rather, a sequence of ASCII characters, which is basically the same) and not a string so that the string representation would depend on the encoding used. But given the nature of Base64, the string representation of the characters used is widely independent of the encoding used as long as it is a single-byte encoding. Specifically, ASCII, ISO-8859-1 and UTF-8 all yield the same results.
public static final byte[] decode(byte[] data)
Passing in null
returns null
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |