org.keyczar.util
Class Base64Coder

java.lang.Object
  extended by org.keyczar.util.Base64Coder

public class Base64Coder
extends java.lang.Object

A web-safe Base64 encoding and decoding utility class. See RFC 3548

Author:
steveweis@gmail.com (Steve Weis)

Method Summary
static byte[] decode(java.lang.String source)
          Decodes a web-safe Base64 encoded string
static java.lang.String encode(byte[] input)
          Encodes an arbitrary array of input as a web-safe Base64 string.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

decode

public static byte[] decode(java.lang.String source)
                     throws Base64DecodingException
Decodes a web-safe Base64 encoded string

Parameters:
source - The string to decode. May contain whitespace and optionally up to two padding '=' characters.
Returns:
A byte array representation of the encoded data.
Throws:
Base64DecodingException - If the source string contains an illegal character or is of an illegal length (1 mod 4).

encode

public static java.lang.String encode(byte[] input)
Encodes an arbitrary array of input as a web-safe Base64 string.

Parameters:
input - Input bytes to encode as a web-safe Base64 String
Returns:
A web-safe Base64 representation of the input. This string will not be padded with '=' characters.