public class Base64
extends java.lang.Object
Note that 3 bytes base 16 (hexadecimal) are encoded into 4 bytes base 64, so the final length is 33% bigger.
| Modifier and Type | Field and Description |
|---|---|
static int[] |
toBase10
Convertion table from base 64 to base 10
|
static char[] |
toBase64
Convertion table from base 10 to base 64
|
| Constructor and Description |
|---|
Base64() |
| Modifier and Type | Method and Description |
|---|---|
static int |
decode(byte[] src,
int srcStart,
int srcLength,
byte[] dest,
int destStart)
Decodes a given base 64 data into a base 10 data.
Important: error detection is NOT made, so you must be sure that no invalid characters are given! Important: it does not check if the destiny has the proper size |
static void |
decode(ByteArrayStream in,
ByteArrayStream out)
Decodes a given base 64 stream into a base 10 stream.
Important: error detection is NOT made, so you must be sure that no invalid characters are given! |
static byte[] |
decode(java.lang.String inStr)
Decodes the given string into a byte array with the exact size.
|
static java.lang.String |
encode(byte[] bytes)
Encodes the given byte array and returns a base 64 generated string.
|
static byte[] |
encode(byte[] bytes,
int count)
Encodes the given byte array and returns a base 64 generated byte array.
|
static java.lang.String |
encode(byte[] bytes,
int start,
int count)
Encodes the given byte array and returns a base 64 generated string.
|
static void |
encode(ByteArrayStream in,
ByteArrayStream out)
Encodes a given base 10 stream into a base 64 stream.
|
public static final char[] toBase64
public static int[] toBase10
public static void decode(ByteArrayStream in, ByteArrayStream out)
in - The base 64 input stream. Its position must be set to the current size of the input data.out - The base 10 output stream. When returning, its position will be set with the output size in bytes.public static int decode(byte[] src,
int srcStart,
int srcLength,
byte[] dest,
int destStart)
src - The base 64 input data.dest - The base 10 output data.srcStart - First position from the sourcesrcLength - How many bytes should be read?destStart - First position to be written in the destinypublic static byte[] decode(java.lang.String inStr)
inStr - The input string in base 64.public static java.lang.String encode(byte[] bytes)
bytes - The base 10 byte array to be encoded into base 64.public static java.lang.String encode(byte[] bytes,
int start,
int count)
bytes - The base 10 byte array to be encoded into base 64.start - The start position in the array.count - The number of bytes to encode.public static byte[] encode(byte[] bytes,
int count)
bytes - The base 10 byte array to be encoded into base 64.public static void encode(ByteArrayStream in, ByteArrayStream out)
in - The Base 10 intput stream. Its position must be set to the current size of the input data.out - The Base 64 ouput stream. When returning, its position will be set with the output size in bytes.