Package org.shoal.ha.cache.impl.util
Class Utility
- java.lang.Object
-
- org.shoal.ha.cache.impl.util.Utility
-
public final class Utility extends java.lang.Object- Author:
- V2.x Handy class full of static functions.
-
-
Constructor Summary
Constructors Constructor Description Utility()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intbytesToInt(byte[] array, int offset)Unmarshal a byte array to an integer.static longbytesToLong(byte[] array, int offset)static byte[]intToBytes(int value)Marshal an integer to a byte array.static voidintToBytes(int value, byte[] array, int offset)static byte[]longToBytes(long value)Unmarshal a byte array to an long.static voidlongToBytes(long value, byte[] array, int offset)Marshal an long to a byte array.
-
-
-
Method Detail
-
bytesToInt
public static int bytesToInt(byte[] array, int offset)Unmarshal a byte array to an integer. Assume the bytes are in BIGENDIAN order. i.e. array[offset] is the most-significant-byte and array[offset+3] is the least-significant-byte.- Parameters:
array- The array of bytes.offset- The offset from which to start unmarshalling.
-
intToBytes
public static byte[] intToBytes(int value)
Marshal an integer to a byte array. The bytes are in BIGENDIAN order. i.e. array[offset] is the most-significant-byte and array[offset+3] is the least-significant-byte.
-
intToBytes
public static void intToBytes(int value, byte[] array, int offset)
-
longToBytes
public static byte[] longToBytes(long value)
Unmarshal a byte array to an long. Assume the bytes are in BIGENDIAN order. i.e. array[offset] is the most-significant-byte and array[offset+7] is the least-significant-byte.
-
bytesToLong
public static long bytesToLong(byte[] array, int offset)
-
longToBytes
public static void longToBytes(long value, byte[] array, int offset)Marshal an long to a byte array. The bytes are in BIGENDIAN order. i.e. array[offset] is the most-significant-byte and array[offset+7] is the least-significant-byte.- Parameters:
array- The array of bytes.offset- The offset from which to start marshalling.
-
-