|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.h2.util.ByteUtils
public class ByteUtils
This utility class contains functions related to byte arrays.
Method Summary | |
---|---|
static void |
clear(byte[] buff)
Set all elements of the array to zero. |
static byte[] |
cloneByteArray(byte[] b)
Create a new byte array and copy all the data. |
static int |
compareNotNull(byte[] data1,
byte[] data2)
Compare the contents of two byte arrays. |
static boolean |
compareSecure(byte[] test,
byte[] good)
Compare two byte arrays. |
static java.lang.String |
convertBytesToString(byte[] value)
Convert a byte array to a hex encoded string. |
static java.lang.String |
convertBytesToString(byte[] value,
int len)
Convert a byte array to a hex encoded string. |
static byte[] |
convertStringToBytes(java.lang.String s)
Convert a hex encoded string to a byte array. |
static byte[] |
copy(byte[] source,
byte[] target)
Copy the contents of the source array to the target array. |
static int |
getByteArrayHash(byte[] value)
Calculate the hash code of the given byte array. |
static int |
indexOf(byte[] bytes,
byte[] pattern,
int start)
Calculate the index of the first occurrence of the pattern in the byte array, starting with the given index. |
static long |
readLong(byte[] buff,
int pos)
Read a long value from the byte array at the given position. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static long readLong(byte[] buff, int pos)
buff
- the byte arraypos
- the position
public static int indexOf(byte[] bytes, byte[] pattern, int start)
bytes
- the byte arraypattern
- the patternstart
- the start index from where to search
public static byte[] convertStringToBytes(java.lang.String s) throws java.sql.SQLException
s
- the hex encoded string
java.sql.SQLException
public static int getByteArrayHash(byte[] value)
value
- the byte array
public static java.lang.String convertBytesToString(byte[] value)
value
- the byte array
public static java.lang.String convertBytesToString(byte[] value, int len)
value
- the byte arraylen
- the number of bytes to encode
public static boolean compareSecure(byte[] test, byte[] good)
test
- the first arraygood
- the second array
public static void clear(byte[] buff)
buff
- the byte arraypublic static int compareNotNull(byte[] data1, byte[] data2)
data1
- the first byte array (must not be null)data2
- the second byte array (must not be null)
public static byte[] copy(byte[] source, byte[] target)
source
- the source arraytarget
- the target array
public static byte[] cloneByteArray(byte[] b)
b
- the byte array (may not be null)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |