Project Aristotle - ArisID Attribute Services

org.openliberty.arisid.util
Class Base64Handler

java.lang.Object
  extended by org.openliberty.arisid.util.Base64Handler

public class Base64Handler
extends java.lang.Object

Base64 Handler for encode/decode. This handler supports the ability to use different Base64 encode/decode implementations. To switch Base64 implementation, a wrapper module must be written that implements the IBase64 interface. To switch Base64 provider, set the system property "org.openliberty.arisid.util.Base64.class" BASE64_CLASS to the name of the class implementing IBase64. The Base64 implementation will be instantiated on the first call to Base64.getInstance()


Field Summary
static java.lang.String BASE64_CLASS
           
static java.lang.String DEF_BASE64_CLASS
           
 
Method Summary
 byte[] decode(java.lang.String inStr)
          Decodes Base64 encoded data into byte array
 java.lang.String encode(byte[] inBytes)
          Encodes byte array into Base64 string
static Base64Handler getInstance()
          Obtains a handle to the Base64 encode/decode class.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BASE64_CLASS

public static final java.lang.String BASE64_CLASS
See Also:
Constant Field Values

DEF_BASE64_CLASS

public static final java.lang.String DEF_BASE64_CLASS
Method Detail

getInstance

public static Base64Handler getInstance()
Obtains a handle to the Base64 encode/decode class. The first time this method is called, the declared Base64 encode/deocde implementation class will be instantiated. The default is: "org.openliberty.arisid.util.Base64" To override the default, set the system property "org.openliberty.arisid.base64.class" to the name of the class implementing IBase64 interface.

Returns:
a handler to the Base64Handler system
Throws:
java.lang.ClassCastException - If the specified class does not implement IBase64
java.lang.ClassNotFoundException - If the specified class cannot be loaded.

encode

public java.lang.String encode(byte[] inBytes)
Encodes byte array into Base64 string

Parameters:
inBytes - Array containing binary data
Returns:
Base64 encoded string

decode

public byte[] decode(java.lang.String inStr)
Decodes Base64 encoded data into byte array

Parameters:
inStr - Base64 encoded string
Returns:
byte array containing decoded data

OpenLiberty.org - Licensed under Apache APL 2.0