intarsys runtime library

de.intarsys.tools.encoding
Class Base64

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

public class Base64
extends Object

An encoder for the BASE 64 code.


Constructor Summary
Base64()
           
 
Method Summary
static byte[] decode(byte[] inputBytes)
          Decodes Base64 data into octects
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(String isValidString)
           
static byte[] removeWhiteSpace(byte[] data)
          Remove whitespace from MIME containing encoded Base64 data. e.g. " sdffferererrereresfsdfsdfsdff\n\r iiiiiiiiierejrlkwjerklwjerwerwr==\n\r"
 
Methods inherited from class java.lang.Object
equals, 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 octects

Parameters:
inputBytes - Byte array containing Base64 data
Returns:
Array containind 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(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.

intarsys runtime library

Copyright © 2008 intarsys consulting GmbH. All Rights Reserved.