Package org.castor.core.util
Class Base64Encoder
- java.lang.Object
-
- org.castor.core.util.Base64Encoder
-
public final class Base64Encoder extends java.lang.Object
Class encodes the bytes written to the OutPutStream to a Base64 encoded string. The encoded string can be retrieved by as a whole by the toString() method or splited into lines of 72 characters by the toStringArray() method.- 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 Base64Encoder()
Construct a Base64Encoder.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static char[]
encode(byte[] bytes)
Encode given byte array into a encoded character array.char[]
getCharArray()
Get Base64 encoded characters as an array.void
reset()
Reset Base64Encoder to its initial state.void
translate(byte[] bytes)
Translate all bytes of given array by appending each to octet buffer.
-
-
-
Method Detail
-
encode
public static char[] encode(byte[] bytes)
Encode given byte array into a encoded character array.- Parameters:
bytes
- The byte array to be encoded.- Returns:
- Base64 encoded characters as an array.
-
reset
public void reset()
Reset Base64Encoder to its initial state. Take care using this method as it throws all previously written bytes away.
-
translate
public void translate(byte[] bytes)
Translate all bytes of given array by appending each to octet buffer. If buffer contains 3 octets its content will be encoded to 4 sextet byte values which are converted to a base64 character each. All characters are appended to a StringBuffer.- Parameters:
bytes
- The byte array to be encoded.
-
getCharArray
public char[] getCharArray()
Get Base64 encoded characters as an array.- Returns:
- Base64 encoded characters as an array.
-
-