com.jkristian.io
Class Base64

java.lang.Object
  extended by com.jkristian.io.Base64

public class Base64
extends java.lang.Object

Utility functions for Base64 encoding and decoding.

Base64 encoding is defined by RFC 2045 (MIME) section 6.8.


Field Summary
static java.lang.String ALPHABET
          Characters that are significant in encoded data.
static char PAD
          This character is appended to encoded data, as needed to make the encoding an integral multiple of four bytes long.
 
Constructor Summary
Base64()
           
 
Method Summary
static byte[] decode(byte[] in)
           
static byte[] encode(byte[] b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PAD

public static final char PAD
This character is appended to encoded data, as needed to make the encoding an integral multiple of four bytes long.

See Also:
Constant Field Values

ALPHABET

public static final java.lang.String ALPHABET
Characters that are significant in encoded data. ALPHABET.charAt(0) encodes 0, and so on up to ALPHABET.charAt(63) which encodes 63. ALPHABET.charAt(64) is PAD.

See Also:
Constant Field Values
Constructor Detail

Base64

public Base64()
Method Detail

encode

public static byte[] encode(byte[] b)
Returns:
the base64 encoding of the given bytes.

decode

public static byte[] decode(byte[] in)
Returns:
the bytes decoded from the given base64 string.