org.castor.util
Class Base64Encoder
java.lang.Object
org.castor.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.
$Revision: 6907 $ $Date: 2005-08-05 13:58:36 -0600 (Fri, 05 Aug 2005) $
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.
|
Base64Encoder
public Base64Encoder()
Construct a Base64Encoder.
encode
public static char[] encode(byte[] bytes)
Encode given byte array into a encoded character array.
bytes
- The byte array to be encoded.
- Base64 encoded characters as an array.
getCharArray
public char[] getCharArray()
Get Base64 encoded characters as an array.
- 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.
bytes
- The byte array to be encoded.
Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com