public class Base64 extends Object
A class for encoding and decoding to and from Base64. Also contains Binary identifiers which are used to indicate what type a message is when transferred in Base64. This is done by adding a one byte prefix to the start of the encoded message.
Modifier and Type | Field and Description |
---|---|
static char |
BYTE
The binary indentifier for a byte.
|
static char |
DOUBLE
The binary indentifier for a double.
|
static char |
FLOAT
The binary indentifier for a float.
|
static char |
INT
The binary indentifier for a int.
|
static char |
LONG
The binary indentifier for a lgon.
|
static char |
OPAQUE
The binary indentifier for an opaque type.
|
static char |
SHORT
The binary indentifier for a short.
|
static char |
STRING
The binary indentifier for a string.
|
static char |
U_BYTE
The binary indentifier for an unsigned byte.
|
static char |
U_INT
The binary indentifier for an unsigned int.
|
static char |
U_LONG
The binary indentifier for an unsigned long.
|
static char |
U_SHORT
The binary indentifier for an unsigned short.
|
Constructor and Description |
---|
Base64() |
Modifier and Type | Method and Description |
---|---|
static byte[] |
encode(byte b)
Base64 encodes a byte value.
|
static byte[] |
encode(byte[] bytes)
Base64 encodes an opaque type.
|
static byte[] |
encode(double d)
Base64 encodes a double value.
|
static byte[] |
encode(float f)
Base64 encodes a float value.
|
static byte[] |
encode(int i)
Base64 encodes an int value.
|
static byte[] |
encode(long l)
Base64 encodes a long value.
|
static byte[] |
encode(short s)
Base64 encodes a short value.
|
static byte |
getByte(String str)
Decodes a Base64 encoded
String and converts it
into a byte value. |
static double |
getDouble(String str)
Decodes a Base64 encoded
String and converts it
into a double value. |
static float |
getFloat(String str)
Decodes a Base64 encoded
String and converts it
into a float value. |
static int |
getInt(String str)
Decodes a Base64 encoded
String and converts it
into an int value. |
static long |
getLong(String str)
Decodes a Base64 encoded
String and converts it
into a long value. |
static byte[] |
getOpaque(String str)
Decodes a Base64 encoded
String and converts it
into an opaque value. |
static short |
getShort(String str)
Decodes a Base64 encoded
String and converts it
into a short value. |
static String |
getString(String str)
Decodes a Base64 encoded
String and converts it
into a String value. |
public static final char FLOAT
The binary indentifier for a float.
public static final char DOUBLE
The binary indentifier for a double.
public static final char BYTE
The binary indentifier for a byte.
public static final char SHORT
The binary indentifier for a short.
public static final char INT
The binary indentifier for a int.
public static final char LONG
The binary indentifier for a lgon.
public static final char U_BYTE
The binary indentifier for an unsigned byte.
public static final char U_SHORT
The binary indentifier for an unsigned short.
public static final char U_INT
The binary indentifier for an unsigned int.
public static final char U_LONG
The binary indentifier for an unsigned long.
public static final char STRING
The binary indentifier for a string.
public static final char OPAQUE
The binary indentifier for an opaque type.
public static double getDouble(String str) throws InvalidBase64DataException
Decodes a Base64 encoded String
and converts it
into a double value.
str
- the string to be decoded.InvalidBase64DataException
- if the String was incomplete.public static float getFloat(String str) throws InvalidBase64DataException
Decodes a Base64 encoded String
and converts it
into a float value.
str
- the string to be decoded.InvalidBase64DataException
- if the String was incomplete.public static byte getByte(String str) throws InvalidBase64DataException
Decodes a Base64 encoded String
and converts it
into a byte value.
str
- the string to be decoded.InvalidBase64DataException
- if the String was incomplete.public static short getShort(String str) throws InvalidBase64DataException
Decodes a Base64 encoded String
and converts it
into a short value.
str
- the string to be decoded.InvalidBase64DataException
- if the String was incomplete.public static int getInt(String str) throws InvalidBase64DataException
Decodes a Base64 encoded String
and converts it
into an int value.
str
- the string to be decoded.InvalidBase64DataException
- if the String was incomplete.public static long getLong(String str) throws InvalidBase64DataException
Decodes a Base64 encoded String
and converts it
into a long value.
str
- the string to be decoded.InvalidBase64DataException
- if the String was incomplete.public static String getString(String str) throws InvalidBase64DataException
Decodes a Base64 encoded String
and converts it
into a String
value.
str
- the string to be decoded.InvalidBase64DataException
- if the String was incomplete.public static byte[] getOpaque(String str) throws InvalidBase64DataException
Decodes a Base64 encoded String
and converts it
into an opaque value.
str
- the string to be decoded.InvalidBase64DataException
- if the String was incomplete.public static byte[] encode(byte b)
Base64 encodes a byte value.
b
- the byte to be encoded.public static byte[] encode(short s)
Base64 encodes a short value.
s
- the short to be encoded.public static byte[] encode(int i)
Base64 encodes an int value.
i
- the int to be encoded.public static byte[] encode(long l)
Base64 encodes a long value.
l
- the long to be encoded.public static byte[] encode(double d)
Base64 encodes a double value.
d
- the double to be encoded.public static byte[] encode(float f)
Base64 encodes a float value.
f
- the float to be encoded.public static byte[] encode(byte[] bytes)
Base64 encodes an opaque type.
bytes
- the opaque type to be encoded.Please send bug reports and comments to Caplin support