org.opends.server.util
Class Base64

java.lang.Object
  extended by org.opends.server.util.Base64

@PublicAPI(stability=UNCOMMITTED,
           mayInstantiate=false,
           mayExtend=false,
           mayInvoke=true)
public final class Base64
extends java.lang.Object

This class provides methods for performing base64 encoding and decoding. Base64 is a mechanism for encoding binary data in ASCII form by converting sets of three bytes with eight significant bits each to sets of four bytes with six significant bits each.


Method Summary
static byte[] decode(java.lang.String encodedData)
          Decodes the provided set of base64-encoded data.
static java.lang.String encode(byte[] rawData)
          Encodes the provided raw data using base64.
static void main(java.lang.String[] args)
          Provide a command-line utility that may be used to base64-encode and decode strings and file contents.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

encode

public static java.lang.String encode(byte[] rawData)
Encodes the provided raw data using base64.

Parameters:
rawData - The raw data to encode. It must not be null.
Returns:
The base64-encoded representation of the provided raw data.

decode

public static byte[] decode(java.lang.String encodedData)
                     throws java.text.ParseException
Decodes the provided set of base64-encoded data.

Parameters:
encodedData - The base64-encoded data to decode. It must not be null.
Returns:
The decoded raw data.
Throws:
java.text.ParseException - If a problem occurs while attempting to decode the provided data.

main

public static void main(java.lang.String[] args)
Provide a command-line utility that may be used to base64-encode and decode strings and file contents.

Parameters:
args - The command-line arguments provided to this program.