com.sleepycat.db.internal

Class DbUtil

public class DbUtil extends Object

DbUtil is a simple class that holds a few static utility functions other parts of the package share and that don't have a good home elsewhere. (For now, that's limited to byte-array-to-int conversion and back.)
Method Summary
static intarray2int(byte[] arr, int offset)
Get the u_int32_t stored beginning at offset "offset" into array "arr".
static StringbyteArrayToString(byte[] barr)
Convert a byte array to a concise, readable string suitable for use in toString methods of the *Stat classes.
static intdefault_lorder()
static voidint2array(int n, byte[] arr, int offset)
Store the specified u_int32_t, with endianness appropriate to the platform we're running on, into four consecutive bytes of the specified byte array, starting from the specified offset.
static StringobjectArrayToString(Object[] arr, String name)
Convert an object array to a string, suitable for use in toString methods of the *Stat classes.

Method Detail

array2int

public static int array2int(byte[] arr, int offset)
Get the u_int32_t stored beginning at offset "offset" into array "arr". We have to do the conversion manually since it's a C-native int, and we're not really supposed to make this kind of cast in Java.

Returns: Description of the Return Value

byteArrayToString

public static String byteArrayToString(byte[] barr)
Convert a byte array to a concise, readable string suitable for use in toString methods of the *Stat classes.

Returns: Description of the Return Value

default_lorder

public static int default_lorder()

int2array

public static void int2array(int n, byte[] arr, int offset)
Store the specified u_int32_t, with endianness appropriate to the platform we're running on, into four consecutive bytes of the specified byte array, starting from the specified offset.

objectArrayToString

public static String objectArrayToString(Object[] arr, String name)
Convert an object array to a string, suitable for use in toString methods of the *Stat classes.

Returns: Description of the Return Value