javazoom.download.util
Class Base64

java.lang.Object
  |
  +--javazoom.download.util.Base64

public class Base64
extends java.lang.Object

Base64 encoding/decoding implementation as described in section (6.8.) of RFC 2045.


Field Summary
static char[] translationTable
          the Base64 translation table; does the same as 'encode()', but this way decoding should be faster.
 
Constructor Summary
Base64()
           
 
Method Summary
static char decode(char a)
          Decodes a Base64 character into its 6-bit value (0..63).
static char[] decode(char[] text)
          Decodes Base64 formatted byte array or string into a char array.
static char[] decode(java.lang.String text)
          Decodes Base64 formatted byte array or string into a char array.
static byte[] decodeToByteArray(char[] text)
           
static byte[] decodeToByteArray(java.lang.String text)
           
static char[] encode(char[] text)
          Encode char array to Base64 formatted char array.
static char encode(int a)
          Encodes a 6-bit value (0..63) into a Base64 character.
static char[] encode(java.lang.String text)
          Encode string to Base64 formatted char array.
static void setLbcs(char[] l)
          set the line break chracters for use in encoding output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

translationTable

public static final char[] translationTable
the Base64 translation table; does the same as 'encode()', but this way decoding should be faster.

Constructor Detail

Base64

public Base64()
Method Detail

encode

public static char[] encode(java.lang.String text)
Encode string to Base64 formatted char array.

Parameters:
text - This argument must contain the text or binary data that shall be encoded. This version of the 'encode()' method accepts a String and converts all line breaks to CRLF (or whatever else you have defined by using 'setLbcs()') prior to encoding. "CRLF" is equal to the Java string "\r\n".

encode

public static char[] encode(char[] text)
Encode char array to Base64 formatted char array.

Parameters:
text - This argument must contain the text or binary data that shall be encoded. This version of the 'encode()' method accepts a char array as input and will - in contrast to the other 'encode()' method - not try to do any conversion at all.

decode

public static char[] decode(java.lang.String text)
Decodes Base64 formatted byte array or string into a char array.

Parameters:
text - This argument must contain the text or data as a string object which shall be decoded.

decodeToByteArray

public static byte[] decodeToByteArray(java.lang.String text)

decodeToByteArray

public static byte[] decodeToByteArray(char[] text)

decode

public static char[] decode(char[] text)
Decodes Base64 formatted byte array or string into a char array.

Parameters:
text - This argument must contain the text or data as a char array object which shall be decoded.

decode

public static char decode(char a)
Decodes a Base64 character into its 6-bit value (0..63).


encode

public static char encode(int a)
Encodes a 6-bit value (0..63) into a Base64 character.


setLbcs

public static void setLbcs(char[] l)
set the line break chracters for use in encoding output. Default is '\r\n'.