|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.openjpa.lib.util.Bytes
public final class Bytes
This class came from the Apache Commons Id sandbox project in support of the UUIDGenerator implementation.
Static methods for managing byte arrays (all methods follow Big Endian order where most significant bits are in front).
Method Summary | |
---|---|
static byte[] |
append(byte[] a,
byte[] b)
Appends two bytes array into one. |
static boolean |
areEqual(byte[] a,
byte[] b)
Compares two byte arrays for equality. |
static int |
compareTo(byte[] lhs,
byte[] rhs)
Compares two byte arrays as specified by Comparable . |
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 long |
toLong(byte[] b)
Build a long from first 8 bytes of the array. |
static short |
toShort(byte[] b)
Build a short from first 2 bytes of the array. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static byte[] append(byte[] a, byte[] b)
a
- A byte[].b
- A byte[].
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 long toLong(byte[] b)
b
- The byte[] to convert.
public static boolean areEqual(byte[] a, byte[] b)
a
- A byte[].b
- A byte[].
public static int compareTo(byte[] lhs, byte[] rhs)
Compares two byte arrays as specified by Comparable
.
lhs
- - left hand value in the comparison operation.rhs
- - right hand value in the comparison operation.
lhs
is less than, equal to, or greater than
rhs
.public static short toShort(byte[] b)
b
- The byte[] to convert.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |