iglu.util
Class Base64

java.lang.Object
  |
  +--iglu.util.Base64

public class Base64
extends java.lang.Object

Basically, the problem is that sometimes you want to store binary objects where you only have text storage facilities. This converts an array of bytes to and from printable only characters so you can store any set of bytes where only text storage is availabe.

This code comes from the book _Java Crypotgraphy_ by Jonathan Knudsen published by O'Reilly. It's inclusion in IGLU is in accordance with O'Reilly's fair use policy as noted at: http://www.oreilly.com/ask_tim/codepolicy_1101.html.


Constructor Summary
Base64()
           
 
Method Summary
static byte[] decode(java.lang.String base64)
          Decode the string to its equivalent non-printable byte array
static java.lang.String encode(byte[] raw)
          encode the given byte array as a printable string
protected static char[] encodeBlock(byte[] raw, int offset)
          Encode the indicated block
protected static char getChar(int sixBit)
           
protected static int getValue(char c)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Base64

public Base64()
Method Detail

encode

public static java.lang.String encode(byte[] raw)
encode the given byte array as a printable string


encodeBlock

protected static char[] encodeBlock(byte[] raw,
                                    int offset)
Encode the indicated block


getChar

protected static char getChar(int sixBit)

decode

public static byte[] decode(java.lang.String base64)
Decode the string to its equivalent non-printable byte array


getValue

protected static int getValue(char c)