org.cdlib.xtf.util
Class Base64

Object
  extended by Base64

public class Base64
extends Object

Utility class that decodes Base64 data.


Constructor Summary
Base64()
           
 
Method Summary
private static String decodeBits(int bits1, int pos1, int count1, int bits2, int pos2, int count2)
          Combines bits from two different bytes into a single character.
private static int decodeChar(char c)
          Given a character in the Base64 set, figure out the decimal equivalent.
private static String decodeQuantum(String quantum)
          Decodes a 4-character Base64 'quantum' into a 3-character string.
static String decodeString(String base64)
          Decodes a full Base64 string to the corresponding normal string.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Base64

public Base64()
Method Detail

decodeChar

private static int decodeChar(char c)
Given a character in the Base64 set, figure out the decimal equivalent.

Parameters:
c - The character to decode
Returns:
The decimal equivalent (also maps invalid chars to zero)

decodeBits

private static String decodeBits(int bits1,
                                 int pos1,
                                 int count1,
                                 int bits2,
                                 int pos2,
                                 int count2)
Combines bits from two different bytes into a single character.


decodeQuantum

private static String decodeQuantum(String quantum)
Decodes a 4-character Base64 'quantum' into a 3-character string.


decodeString

public static String decodeString(String base64)
Decodes a full Base64 string to the corresponding normal string.

Parameters:
base64 - The base64 string to decode (e.g. "HX1+9/6fE97=")
Returns:
Decoded version of the string.