|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--org.apache.java.lang.Bytes
Static methods for managing byte arrays (all methods follow Big Endian order where most significant bits are in front).
| Field Summary | |
private static char[] |
hexDigits
|
| Constructor Summary | |
Bytes()
|
|
| Method Summary | |
static byte[] |
append(byte[] a,
byte[] b)
Appends two bytes array into one. |
static byte[] |
append(byte[] a,
byte[] b,
byte[] c)
Appends three bytes array into one. |
static boolean |
areEqual(byte[] a,
byte[] b)
Compares two byte arrays for equality. |
static byte[] |
copy(byte[] b,
int pos)
Gets the end of the byte array given. |
static byte[] |
copy(byte[] b,
int pos,
int length)
Gets a sub-set of the byte array given. |
static void |
merge(byte[] src,
byte[] dest)
Merges a bytes array into another. |
static void |
merge(byte[] src,
byte[] dest,
int pos)
Merges a bytes array into another starting from the given position. |
static void |
merge(byte[] src,
byte[] dest,
int pos,
int length)
Merges a bytes array into another starting from the given position. |
static void |
merge(byte[] src,
byte[] dest,
int srcpos,
int destpos,
int length)
Merges a bytes array into another starting from the given positions. |
static byte[] |
toBytes(int n)
Returns a 4-byte array built from an int. |
static byte[] |
toBytes(int n,
byte[] b)
Build a 4-byte array from an int. |
static byte[] |
toBytes(long n)
Returns a 8-byte array built from a long. |
static byte[] |
toBytes(long n,
byte[] b)
Build a 8-byte array from a long. |
static int |
toInt(byte[] b)
Build an int from first 4 bytes of the array. |
static long |
toLong(byte[] b)
Build a long from first 8 bytes of the array. |
static java.lang.String |
toString(byte[] b)
Returns a string of hexadecimal digits from a byte array.. |
static java.lang.String |
toString(byte[] b,
int offset,
int length)
Returns a string of hexadecimal digits from a byte array, starting at offset and continuing for length bytes. |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
private static final char[] hexDigits
| Constructor Detail |
public Bytes()
| Method Detail |
public static int toInt(byte[] b)
b - the byte array to convert.public static long toLong(byte[] b)
b - the byte array to convert.public static byte[] toBytes(int n)
n - the number to convert.
public static byte[] toBytes(int n,
byte[] b)
n - the number to convert.b - the array to fill.public static byte[] toBytes(long n)
n - the number to convert.
public static byte[] toBytes(long n,
byte[] b)
n - the number to convert.b - the array to fill.
public static boolean areEqual(byte[] a,
byte[] b)
public static byte[] append(byte[] a,
byte[] b)
public static byte[] append(byte[] a,
byte[] b,
byte[] c)
public static byte[] copy(byte[] b,
int pos)
b - byte arraypos - the position from which to start
public static byte[] copy(byte[] b,
int pos,
int length)
b - byte arraypos - the position from which to startlength - the number of bytes to copy from the original byte array
to the new one.
public static void merge(byte[] src,
byte[] dest,
int srcpos,
int destpos,
int length)
public static void merge(byte[] src,
byte[] dest,
int pos)
public static void merge(byte[] src,
byte[] dest)
public static void merge(byte[] src,
byte[] dest,
int pos,
int length)
public static java.lang.String toString(byte[] b,
int offset,
int length)
public static java.lang.String toString(byte[] b)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||