Methods Summary |
---|
public static java.io.BufferedReader | decode(java.lang.String b64string)
return new BufferedReader(
new InputStreamReader(
MimeUtility.decode(
new ByteArrayInputStream(
b64string.getBytes()), "base64")));
|
public static java.lang.String | decodeAsString(java.lang.String b64string)
if (b64string == null) {
return b64string;
}
String returnString = decode(b64string).readLine();
if (returnString == null) {
return returnString;
}
return returnString.trim();
|
public static java.io.ByteArrayOutputStream | encode(java.lang.String plaintext)
ByteArrayOutputStream out = new ByteArrayOutputStream();
byte[] in = plaintext.getBytes();
ByteArrayOutputStream inStream = new ByteArrayOutputStream();
inStream.write(in, 0, in.length);
// pad
if ((in.length % 3 ) == 1){
inStream.write(0);
inStream.write(0);
} else if((in.length % 3 ) == 2){
inStream.write(0);
}
inStream.writeTo( MimeUtility.encode(out, "base64") );
return out;
|
public static java.lang.String | encodeAsString(java.lang.String plaintext)
return encode(plaintext).toString();
|