org.castor.util

Class Base64Decoder

public final class Base64Decoder extends Object

Class decodes a Base64 encoded string back into the original byte representation that can be read as byte array.

Since: 0.9.9

Version: $Revision: 5951 $ $Date: 2005-08-05 13:58:36 -0600 (Fri, 05 Aug 2005) $

Author: Ralf Joachim

Constructor Summary
Base64Decoder()
Construct a default Base64Decoder waiting on calls to its translate() method.
Method Summary
static byte[]decode(String str)
Decode given string into a decoded byte array.
byte[]getByteArray()
Get all decoded octets as byte array.
voidtranslate(String string)
Translate every base64 character from given string into a sextet byte value by using above translation array.

Constructor Detail

Base64Decoder

public Base64Decoder()
Construct a default Base64Decoder waiting on calls to its translate() method.

Method Detail

decode

public static byte[] decode(String str)
Decode given string into a decoded byte array.

Parameters: str Base64 String to be decoded.

Returns: All decoded octets as byte array.

getByteArray

public byte[] getByteArray()
Get all decoded octets as byte array.

Returns: All decoded octets as byte array.

translate

public void translate(String string)
Translate every base64 character from given string into a sextet byte value by using above translation array. The sextets are then shiftet into an buffer until the buffer contains 4 sextets which are then decoded into 3 octets. The translate and decode process is continued until all characters of given string are evaluated. If there are remaing sextets in the buffer they also will be converted into octets at the end. All the converted octets are added to the list for later read.

Parameters: string Base64 String to be decoded.

Intalio Inc. (C) 1999-2006. All rights reserved http://www.intalio.com