Package org.castor.core.util
Class Base64Decoder
- java.lang.Object
-
- org.castor.core.util.Base64Decoder
-
public final class Base64Decoder extends java.lang.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: 6907 $ $Date: 2005-08-05 13:58:36 -0600 (Fri, 05 Aug 2005) $
- Author:
- Ralf Joachim
-
-
Constructor Summary
Constructors Constructor Description Base64Decoder()
Construct a default Base64Decoder waiting on calls to its translate() method.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static byte[]
decode(java.lang.String str)
Decode given string into a decoded byte array.byte[]
getByteArray()
Get all decoded octets as byte array.void
translate(java.lang.String string)
Translate every base64 character from given string into a sextet byte value by using above translation array.
-
-
-
Method Detail
-
decode
public static byte[] decode(java.lang.String str)
Decode given string into a decoded byte array.- Parameters:
str
- Base64 String to be decoded.- Returns:
- All decoded octets as byte array.
-
translate
public void translate(java.lang.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.
-
getByteArray
public byte[] getByteArray()
Get all decoded octets as byte array.- Returns:
- All decoded octets as byte array.
-
-