com.google.checkout.util
Class Base64Coder

java.lang.Object
  extended by com.google.checkout.util.Base64Coder

public class Base64Coder
extends java.lang.Object

The Base64Coder class provides methods for encoding strings and byte arrays into Base64 format. It also provides methods for decoding Base64-encoded strings and character arrays.

Version:
1.0 beta

Method Summary
static byte[] decode(char[] in)
          The decode (char[] in) method decodes an array of Base64-encoded characters.
static java.lang.String decode(java.lang.String s)
          The decode (String s) method decodes a Base64-encoded string.
static char[] encode(byte[] in)
          The encode (byte[] in) method encodes a byte array into Base64 format.
static java.lang.String encode(java.lang.String s)
          The encode (String s) method encodes a string into Base64 format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

encode

public static java.lang.String encode(java.lang.String s)
The encode (String s) method encodes a string into Base64 format. No blanks or line breaks are inserted.

Parameters:
s - The string to be encoded.
Returns:
String in Base64-encoded format.

encode

public static char[] encode(byte[] in)
The encode (byte[] in) method encodes a byte array into Base64 format. No blanks or line breaks are inserted.

Parameters:
in - An array containing the data bytes to be encoded.
Returns:
A character array containing the Base64-encoded data.

decode

public static java.lang.String decode(java.lang.String s)
The decode (String s) method decodes a Base64-encoded string.

Parameters:
s - The Base64 String to be decoded.
Returns:
A String containing the decoded data.
Throws:
java.lang.IllegalArgumentException - if the input is not valid Base64-encoded data.

decode

public static byte[] decode(char[] in)
The decode (char[] in) method decodes an array of Base64-encoded characters. No blanks or line breaks are allowed within the Base64-encoded data.

Parameters:
in - A character array containing the Base64-encoded data.
Returns:
An array containing the decoded data bytes.
Throws:
java.lang.IllegalArgumentException - if the input is not valid Base64-encoded data.