com.pushtotest.tool.util
Class Base64Codec

java.lang.Object
  extended by com.pushtotest.tool.util.Base64Codec
All Implemented Interfaces:
Codec

public class Base64Codec
extends java.lang.Object
implements Codec

This class provides a Base64 Encoding method. This is used often in the Basic Authentication method of HTTP as well as for transmitting binary data as MIME attachments.


Method Summary
 char[] decode(char[] chars)
          Decode the String from base64
 java.lang.String decode(java.lang.String chars)
          Decode the String from base64
 char[] encode(char[] chars)
          Does the actual encoding process.
 java.lang.String encode(java.lang.String chars)
          Does the actual encoding process.
static Base64Codec getInstance()
          Returns a singleton instance of the Base64Codec
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static Base64Codec getInstance()
Returns a singleton instance of the Base64Codec

Returns:
The codec.

encode

public java.lang.String encode(java.lang.String chars)
Does the actual encoding process.

Specified by:
encode in interface Codec
Parameters:
chars - The String to encode to Base64
Returns:
The Base64 encoded string.

encode

public char[] encode(char[] chars)
Does the actual encoding process.

Specified by:
encode in interface Codec
Parameters:
chars - The character array to encode to Base64
Returns:
The Base64 encoded string.

decode

public java.lang.String decode(java.lang.String chars)
Decode the String from base64

Specified by:
decode in interface Codec
Parameters:
chars - Description of Parameter
Returns:
Decoded string

decode

public char[] decode(char[] chars)
Decode the String from base64

Specified by:
decode in interface Codec
Parameters:
chars - Description of Parameter
Returns:
Decoded string