public class Base64
extends java.lang.Object
This implementation seems to be faster than the one provided by Sun through classes sun.misc.BASE64Encoder and sun.misc.BASE64Decoder. (the comparison has been done on JDK1.4.2 VM for Windows).
Note: The performances could be further increased by implementing the char-to-byte conversion (i.e. the base64 decoding) by using a proper static mapping array.
Constructor and Description |
---|
Base64() |
Modifier and Type | Method and Description |
---|---|
static byte[] |
decode(java.lang.String str64)
Decodes a given base64 string.
|
static java.lang.String |
encode(byte[] input)
Encodes in base64 a given array of bytes.
|
static java.lang.String |
justify(java.lang.String str,
int len)
Justifies a string fitting a given line length.
|
static java.lang.String |
trim(java.lang.String str)
Trims a string removing all non-base64 chars.
|
public static java.lang.String encode(byte[] input)
public static java.lang.String justify(java.lang.String str, int len)
public static java.lang.String trim(java.lang.String str)
public static byte[] decode(java.lang.String str64)