com.sun.slamd.example
Class Base64Encoder

java.lang.Object
  extended bycom.sun.slamd.example.Base64Encoder

public class Base64Encoder
extends java.lang.Object

This class provides methods for encoding and decoding data using the base64 specification as defined in RFC 1521, section 5.2. Although a base64 encoder and decoder are available in the sun.misc package, they should not be used as classes in the sun.misc package are not guaranteed to exist or work, and any program that uses them cannot be considered pure Java.


Field Summary
static char[] BASE64_ALPHABET
          The array of characters that may be used in base64-encoded values.
 
Constructor Summary
Base64Encoder()
           
 
Method Summary
static byte[] decode(java.lang.String encodedValue)
          Base64-decodes the provided string into a byte array.
static java.lang.String encode(byte[] byteArray)
          Base64-encodes the data in the provided byte array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BASE64_ALPHABET

public static final char[] BASE64_ALPHABET
The array of characters that may be used in base64-encoded values.

Constructor Detail

Base64Encoder

public Base64Encoder()
Method Detail

encode

public static java.lang.String encode(byte[] byteArray)
Base64-encodes the data in the provided byte array.

Parameters:
byteArray - The byte array containing the data to encode.
Returns:
The base64-encoded value.

decode

public static byte[] decode(java.lang.String encodedValue)
Base64-decodes the provided string into a byte array.

Parameters:
encodedValue - The string containing the base64-encoded data.
Returns:
The byte array containing the decoded data.