Sun Adapter for LDAP API

com.stc.connector.ldapadapter.utils.cryptography.impl
Class Base64Impl

java.lang.Object
  extended by com.stc.connector.ldapadapter.utils.cryptography.impl.Base64Impl
All Implemented Interfaces:
Base64

public class Base64Impl
extends java.lang.Object
implements Base64

Version:
$Revision: 1.1 $, $Date: 2004/03/04 19:37:02 $
Author:
Not attributable
See Also:
Base64

Constructor Summary
Base64Impl()
           
 
Method Summary
static byte[] decode(byte[] base64Data)
          Decodes Base64 data into octects
static java.lang.String decode(java.lang.String base64Data)
          Decodes Base64 data into octects
 byte[] decodeBase64(byte[] aData)
          Decodes the Base64 encoded aData.
static byte[] encode(byte[] binaryData)
          Encodes hex octects into Base64
static java.lang.String encode(java.lang.String stringData)
          Encodes String into Base64 using the default encoding when converting the String to a byte []
 byte[] encodeBase64(byte[] aData)
          Encodes the aData to Base64 encoded form.
static int getDecodedDataLength(byte[] base64Data)
          returns length of decoded data given an array containing encoded data.
static boolean isArrayByteBase64(byte[] arrayOctect)
           
static boolean isBase64(byte octect)
           
static boolean isBase64(java.lang.String isValidString)
           
protected static boolean isData(byte octect)
           
protected static boolean isPad(byte octect)
           
protected static boolean isWhiteSpace(byte octect)
           
static byte[] removeWhiteSpace(byte[] data)
          remove WhiteSpace from MIME containing encoded Base64 data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Base64Impl

public Base64Impl()
Method Detail

encodeBase64

public byte[] encodeBase64(byte[] aData)
Description copied from interface: Base64
Encodes the aData to Base64 encoded form.

Specified by:
encodeBase64 in interface Base64
Parameters:
aData - The data to be encoded in Base64.
Returns:
byte[] The encoded data.
See Also:
Base64#encodeBase64.

decodeBase64

public byte[] decodeBase64(byte[] aData)
Description copied from interface: Base64
Decodes the Base64 encoded aData.

Specified by:
decodeBase64 in interface Base64
Parameters:
aData - The Base64 encoded data.
Returns:
byte[] The decoded data.
See Also:
Base64#decodeBase64.

isWhiteSpace

protected static boolean isWhiteSpace(byte octect)

isPad

protected static boolean isPad(byte octect)

isData

protected static boolean isData(byte octect)

isBase64

public static boolean isBase64(java.lang.String isValidString)

isBase64

public static boolean isBase64(byte octect)

removeWhiteSpace

public static byte[] removeWhiteSpace(byte[] data)
remove WhiteSpace from MIME containing encoded Base64 data. e.g. " sdffferererrereresfsdfsdfsdff\n\r iiiiiiiiierejrlkwjerklwjerwerwr==\n\r"

Parameters:
data -
Returns:
byte array with whitespace removed

isArrayByteBase64

public static boolean isArrayByteBase64(byte[] arrayOctect)

encode

public static byte[] encode(byte[] binaryData)
Encodes hex octects into Base64

Parameters:
binaryData - Array containing binaryData
Returns:
Encoded Base64 array

encode

public static java.lang.String encode(java.lang.String stringData)
Encodes String into Base64 using the default encoding when converting the String to a byte []

Parameters:
stringData - String containing string data to encode
Returns:
String containing encoded data

decode

public static byte[] decode(byte[] base64Data)
Decodes Base64 data into octects

Parameters:
binaryData - Byte array containing Base64 data
Returns:
Array containind decoded data.

decode

public static java.lang.String decode(java.lang.String base64Data)
Decodes Base64 data into octects

Parameters:
base64Data - String containing Base64 data
Returns:
String containing decoded data

getDecodedDataLength

public static int getDecodedDataLength(byte[] base64Data)
returns length of decoded data given an array containing encoded data. WhiteSpace removing is done if data array not valid.

Parameters:
base64Data -
Returns:
a -1 would be return if not

Sun Adapter for LDAP API