public class ByteTools
extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
VERSION
Version number of this Package (read-only).
|
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
compress(byte... data)
Compresses the provided byte[] array using the GZIP algorithm.
|
static java.io.ByteArrayOutputStream |
compressToStream(byte... data)
Compresses the provided byte[] array using the GZIP algorithm.
|
static byte[] |
decompress(byte... data)
Decompresses the provided byte[] array using the GZIP algorithm.
|
static java.io.ByteArrayOutputStream |
decompressToStream(byte... data)
Decompresses the provided byte[] array using the GZIP algorithm.
|
static String[] |
stringsFromByteArray(byte... b)
Separates any number of Strings from a byte[] array of ASCIIZ Strings
(each String in the byte[] array is terminated by byte 0).
|
static byte[] |
stringsToByteArray(String... ss)
Joins any number of Strings into a byte[] array of ASCIIZ Strings (each
String in the byte[] array is terminated by byte 0).
|
static byte[] |
toArray(byte... p)
Returns any number of byte primitives as a byte[] array.
|
static byte[] |
toArray(double... p)
Returns any number of double primitives as a byte[] array.
|
static byte[] |
toArray(float... p)
Returns any number of float primitives as a byte[] array.
|
static byte[] |
toArray(int... p)
Returns any number of int primitives as a byte[] array.
|
static byte[] |
toArray(long... p)
Returns any number of long primitives as a byte[] array.
|
static byte[] |
toArray(short... p)
Returns any number of short primitives as a byte[] array.
|
static String |
toDebugString(byte... data)
Returns a byte[] array transposed into a String, with functional characters
converted to intuitive non-functional human-readable character sequences.
|
static String |
toDebugString(int begin,
byte... data)
Returns a byte[] array transposed into a String, with functional characters
converted to intuitive non-functional human-readable character sequences.
|
static String |
toDebugString(int begin,
int size,
byte... data)
Returns a byte[] array transposed into a String, with functional characters
converted to intuitive non-functional human-readable character sequences.
|
static String |
toHexString(byte... data)
Returns a byte[] array transposed into a String of hexadecimal digit pairs
as one continuous sequence of characters, with colons inserted between each
pair of two lower-case hexadecimal digits.
|
static String |
toHexString(int begin,
byte... data)
Returns a byte[] array transposed into a String of hexadecimal digit pairs
as one continuous sequence of characters, with colons inserted between each
pair of two lower-case hexadecimal digits.
|
static String |
toHexString(int begin,
int size,
byte... data)
Returns a byte[] array transposed into a String of hexadecimal digit pairs
as one continuous sequence of characters, with colons inserted between each
pair of two lower-case hexadecimal digits.
|
static String |
toHexString(int flags,
int begin,
int size,
byte... data)
Returns a byte[] array transposed into a String of hexadecimal digit pairs
as one continuous sequence of characters with certain customization options.
|
public static final String VERSION
public static byte[] compress(byte... data)
data - The byte[] array to compresspublic static java.io.ByteArrayOutputStream compressToStream(byte... data)
data - The byte[] array to compresspublic static byte[] decompress(byte... data)
throws java.util.zip.ZipException
data - The byte[] array to decompressjava.util.zip.ZipException - If the data is not GZIP formatted or is
otherwise corrupt in some mannerpublic static java.io.ByteArrayOutputStream decompressToStream(byte... data)
throws java.util.zip.ZipException
data - The byte[] array to decompressjava.util.zip.ZipException - If the data is not GZIP formatted or is
otherwise corrupt in some mannerpublic static String[] stringsFromByteArray(byte... b)
Note: If the byte[] array is not empty, and the final byte is not 0, then the array will be treated as if a final 0 byte is present after the array.
b - The byte[] array to parsepublic static byte[] stringsToByteArray(String... ss)
ss - The String objects to joinpublic static byte[] toArray(byte... p)
p - Primitive valuespublic static byte[] toArray(double... p)
p - Primitive valuespublic static byte[] toArray(float... p)
p - Primitive valuespublic static byte[] toArray(int... p)
p - Primitive valuespublic static byte[] toArray(long... p)
p - Primitive valuespublic static byte[] toArray(short... p)
p - Primitive valuespublic static String toDebugString(byte... data)
data - The byte[] array to transposepublic static String toDebugString(int begin,
byte... data)
begin - The first element in the array to start from (0 = first element)data - The byte[] array to transposepublic static String toDebugString(int begin,
int size,
byte... data)
begin - The first element in the array to start from (0 = first element)size - The total number of elements to transpose (or specify -1 for all)data - The byte[] array to transposepublic static String toHexString(byte... data)
data - The byte[] array to transposepublic static String toHexString(int begin,
byte... data)
begin - The first element in the array to start from (0 = first element)data - The byte[] array to transposepublic static String toHexString(int begin,
int size,
byte... data)
begin - The first element in the array to start from (0 = first element)size - The total number of elements to transpose (or specify -1 for all)data - The byte[] array to transposepublic static String toHexString(int flags,
int begin,
int size,
byte... data)
flags - Various configuration flags; 1 = Insert a colon (":") delimiter
between each byte; 2 = Upper case; 4 = Omit leading zeros from digit pairsbegin - The first element in the array to start from (0 = first element)size - The total number of elements to transpose (or specify -1 for all)data - The byte[] array to transpose