public final class Bits extends Object
Modifier and Type | Method and Description |
---|---|
static int |
compareNotNullSigned(byte[] data1,
byte[] data2)
Compare the contents of two byte arrays.
|
static int |
compareNotNullUnsigned(byte[] data1,
byte[] data2)
Compare the contents of two byte arrays.
|
static int |
readInt(byte[] buff,
int pos)
Reads a int value from the byte array at the given position in big-endian
order.
|
static long |
readLong(byte[] buff,
int pos)
Reads a long value from the byte array at the given position in big-endian
order.
|
static byte[] |
uuidToBytes(long msb,
long lsb)
Converts UUID value to byte array in big-endian order.
|
static byte[] |
uuidToBytes(UUID uuid)
Converts UUID value to byte array in big-endian order.
|
static void |
writeInt(byte[] buff,
int pos,
int x)
Writes a int value to the byte array at the given position in big-endian
order.
|
static void |
writeLong(byte[] buff,
int pos,
long x)
Writes a long value to the byte array at the given position in big-endian
order.
|
public static int compareNotNullSigned(byte[] data1, byte[] data2)
This method interprets bytes as signed.
data1
- the first byte array (must not be null)data2
- the second byte array (must not be null)public static int compareNotNullUnsigned(byte[] data1, byte[] data2)
This method interprets bytes as unsigned.
data1
- the first byte array (must not be null)data2
- the second byte array (must not be null)public static int readInt(byte[] buff, int pos)
buff
- the byte arraypos
- the positionpublic static long readLong(byte[] buff, int pos)
buff
- the byte arraypos
- the positionpublic static byte[] uuidToBytes(long msb, long lsb)
msb
- most significant part of UUIDlsb
- least significant part of UUIDpublic static byte[] uuidToBytes(UUID uuid)
uuid
- UUID valuepublic static void writeInt(byte[] buff, int pos, int x)
buff
- the byte arraypos
- the positionx
- the value to writepublic static void writeLong(byte[] buff, int pos, long x)
buff
- the byte arraypos
- the positionx
- the value to writeCopyright © 2020 JBoss by Red Hat. All rights reserved.