com.infoengine.util
Class Base64

java.lang.Object
  extended by com.infoengine.util.Base64

public class Base64
extends java.lang.Object

Utility class providing static methods for encoding and decoding data using the Base64 algorithm specified in Internet Standard RFC2045.


Constructor Summary
Base64()
           
 
Method Summary
static byte[] decode(byte[] encoded)
          Decode a Base64-encoded byte array containing single-byte characters from the Base64 alphabet.
static byte[] decode(byte[] encoded, int offset, int len)
          Decode a subset of a Base64-encoded byte array containing single-byte characters from the Base64 alphabet.
static java.lang.String decode(java.lang.String base64str)
          Decode a Base64-encoded string.
static byte[] encode(byte[] bytes)
          Base64-encode an array of bytes.
static java.lang.String encode(java.lang.String str)
          Base64-encode a string.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Base64

public Base64()
Method Detail

decode

public static final java.lang.String decode(java.lang.String base64str)
Decode a Base64-encoded string. This method should be called only when it is known that the decoded result will be a valid string and not binary data.

Parameters:
base64str - The Base64-encoded string.
Returns:
The decoded result.

decode

public static final byte[] decode(byte[] encoded)
Decode a Base64-encoded byte array containing single-byte characters from the Base64 alphabet.

Parameters:
encoded - The Base64-encoded array of single-byte characters.
Returns:
The decoded result.

decode

public static final byte[] decode(byte[] encoded,
                                  int offset,
                                  int len)
Decode a subset of a Base64-encoded byte array containing single-byte characters from the Base64 alphabet.

Parameters:
encoded - The Base64-encoded array of single-byte characters.
offset - The index of the first character to be decoded.
len - The number of characters to be decoded.
Returns:
The decoded result.

encode

public static final byte[] encode(byte[] bytes)
Base64-encode an array of bytes.

Parameters:
bytes - The array of bytes to be encoded.
Returns:
The Base64-encoded result, as an array of single-byte characters from the Base64 alphabet.

encode

public static final java.lang.String encode(java.lang.String str)
Base64-encode a string.

Parameters:
str - The string to be encoded.
Returns:
The Base64-encoded result, as a string.