Package org.hibernate.internal.util
Class BytesHelper
java.lang.Object
org.hibernate.internal.util.BytesHelper
-
Method Summary
Modifier and TypeMethodDescriptionstatic long
asLong
(byte[] bytes) Interpret the binary representation of a long.static long
asLong
(byte[] bytes, int srcPos) Interpret the binary representation of a long.static byte[]
fromInt
(int intValue) Interpret an int as its binary formstatic byte[]
fromLong
(long longValue) Interpret a long as its binary formstatic void
fromLong
(long longValue, byte[] dest, int destPos) Interpret a long as its binary formstatic byte[]
fromShort
(int shortValue) Interpret a short as its binary formstatic String
toBinaryString
(byte value) static String
toBinaryString
(int value) static String
toBinaryString
(long value) static int
toInt
(byte[] bytes) Custom algorithm used to generate anint
from a series of bytes.
-
Method Details
-
toInt
public static int toInt(byte[] bytes) Custom algorithm used to generate anint
from a series of bytes.- Parameters:
bytes
- The bytes to use in generating the int.- Returns:
- The generated int.
- Implementation Note:
- This is different to interpreting the incoming bytes as an
int
!
-
fromShort
public static byte[] fromShort(int shortValue) Interpret a short as its binary form- Parameters:
shortValue
- The short to interpret to binary- Returns:
- The binary
-
fromInt
public static byte[] fromInt(int intValue) Interpret an int as its binary form- Parameters:
intValue
- The int to interpret to binary- Returns:
- The binary
-
fromLong
public static byte[] fromLong(long longValue) Interpret a long as its binary form- Parameters:
longValue
- The long to interpret to binary- Returns:
- The binary
-
fromLong
public static void fromLong(long longValue, byte[] dest, int destPos) Interpret a long as its binary form- Parameters:
longValue
- The long to interpret to binarydest
- the destination array.destPos
- starting position in the destination array.
-
asLong
public static long asLong(byte[] bytes) Interpret the binary representation of a long.- Parameters:
bytes
- The bytes to interpret.- Returns:
- The long
-
asLong
public static long asLong(byte[] bytes, int srcPos) Interpret the binary representation of a long.- Parameters:
bytes
- The bytes to interpret.srcPos
- starting position in the source array.- Returns:
- The long
-
toBinaryString
-
toBinaryString
-
toBinaryString
-