de.intarsys.tools.encoding
Class Base64

java.lang.Object
  extended by de.intarsys.tools.encoding.Base64

public class Base64
extends java.lang.Object

An encoder for the BASE 64 code.


Constructor Summary
Base64()
           
 
Method Summary
static byte[] decode(byte[] inputBytes)
          Decodes Base64 data into octets
static byte[] encode(byte[] inputBytes)
          Encodes hex octets into Base64
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)
           
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

Base64

public Base64()
Method Detail

decode

public static byte[] decode(byte[] inputBytes)
Decodes Base64 data into octets

Parameters:
inputBytes - Byte array containing Base64 data
Returns:
byte array containing decoded data.

encode

public static byte[] encode(byte[] inputBytes)
Encodes hex octets into Base64

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

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

isArrayByteBase64

public static boolean isArrayByteBase64(byte[] arrayOctect)

isBase64

public static boolean isBase64(byte octect)

isBase64

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

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:
The input data without whitespace.