public class ByteArray extends Object
byte[] to hex most of the time.| Modifier and Type | Field and Description |
|---|---|
static String |
ENCODING
The encoding to use for string operations.
|
| Constructor and Description |
|---|
ByteArray() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
fromBase64String(String base64)
Decodes the given base-64 string into a byte array.
|
static byte[] |
fromHexString(String hex)
With thanks to StackOverflow: Convert a string representation of a hex dump to a byte array using
Java?
|
static byte[] |
fromString(String string)
Converts the given String to a byte array using "UTF8".
|
static String |
toBase64String(byte[] bytes)
Encodes the given byte array as a base-64 String.
|
static String |
toHexString(byte[] bytes)
Renders the given byte array as a hex String.
|
static String |
toString(byte[] bytes)
Converts the given byte array to a String using "UTF8".
|
public static final String ENCODING
public static String toHexString(byte[] bytes)
Hex.encodeHexString(byte[]).bytes - The array to be rendered.public static byte[] fromHexString(String hex)
hex - The hex String to parse. If it starts with 0x, this will be
ignored automatically.public static String toBase64String(byte[] bytes)
Base64.encodeBase64String(byte[]).bytes - The array to be encoded.public static byte[] fromBase64String(String base64)
base64 - A base-64 encoded string.public static byte[] fromString(String string)
string - The String to be converted to a byte array.Copyright © 2015 Carboni. All rights reserved.