public class Binary
extends java.lang.Object
| Constructor and Description |
|---|
Binary() |
| Modifier and Type | Method and Description |
|---|---|
static int |
atoi(java.lang.String s,
int base)
Converts the given number string into an integer.
|
static byte[] |
base64Decode(java.lang.String input)
Decodes the given Base64-encoded string.
|
static java.lang.String |
base64Encode(byte[] input)
Encodes the given byte array to a Base64 string.
|
static java.lang.Object |
deserialize(byte[] source)
Attempts to deserialize the given byte array.
|
static java.lang.String |
itoa(int i,
int base)
Converts the given number to its string representation.
|
static byte[] |
serialize(java.lang.Object source)
Attempts to serialize the given object to a byte array.
|
public static byte[] serialize(java.lang.Object source)
source - the object to serialize.public static java.lang.Object deserialize(byte[] source)
source - the byte array to deserialize.public static java.lang.String base64Encode(byte[] input)
input - The byte array to encode.public static byte[] base64Decode(java.lang.String input)
input - The Base64-encoded string.public static java.lang.String itoa(int i,
int base)
The hexadecimal representation uses the 2's complement to represent negative numbers. Always the smallest possible multiple of 4-bits is used to represent the number. E.g., for -1 the hex representation is 0xf (1111). For -8 it's 0x8 (1000). If we move out of the range [-8, 7], four more bits are added, such that -9 is 0xf7 (1111 0111).
i - The numberbase - The base to use for the string representation. Can be decimal (10) or hexadecimal
(16).public static int atoi(java.lang.String s,
int base)
s - The number string.base - The base to use for interpreting the string. Can be decimal (10) or hexadecimal
(16).