| java.lang.Object dummyCA.Base64
Base64 | public class Base64 (Code) | | This class contains a Base64 encoder and decoder. It cannot be
instantiated. The encoder and decoder are based on RFC 1521, except that
encoder do not break up lines and the decoder will treat a line break as
as invalid characters. This done since MIDP JAD's can not have line breaks
with in an attribute. Also different RFC's use different lengths for
base64 strings such as; 76 for 1521, 64 for 1421, and no breaks for 2228.
For example to decode:
String encodedData;
byte binaryData[];
binaryData = Base64.decode(encodedData);
This will decode the String in encodedData and give you an array
of bytes in the array binaryData.
On errors, this class throws an IOException with the following detail
strings:
"Base64 string not a mulitple of 4"
"Invalid character in Base64 string"
|
Method Summary | |
public static byte[] | decode(String encoded) Converts a Base64 encoded string to a byte array. | public static byte[] | decode(String encoded, int offset, int length) Converts an embedded Base64 encoded string to a byte array. | public static String | encode(byte[] data, int offset, int length) Converts a byte array into a Base64 encoded string. |
decode | public static byte[] decode(String encoded) throws IOException(Code) | | Converts a Base64 encoded string to a byte array.
Parameters: encoded - Base64 encoded data decode binary data; 3 bytes for every 4 chars - minus padding exception: java.io.IOException - is thrown, if an I/O error occurs reading the data |
decode | public static byte[] decode(String encoded, int offset, int length) throws IOException(Code) | | Converts an embedded Base64 encoded string to a byte array.
Parameters: encoded - a String with Base64 data embedded in it Parameters: offset - which char of the String to start at Parameters: length - how many chars to decode; must be a multiple of 4 decode binary data; 3 bytes for every 4 chars - minus padding exception: java.io.IOException - is thrown, if an I/O error occurs reading the data |
encode | public static String encode(byte[] data, int offset, int length)(Code) | | Converts a byte array into a Base64 encoded string.
Parameters: data - bytes to encode Parameters: offset - which byte to start at Parameters: length - how many bytes to encode; padding will be added if needed base64 encoding of data; 4 chars for every 3 bytes |
|
|