Class ObjectDataType
- java.lang.Object
-
- org.dizitart.no2.mvstore.compat.v1.mvstore.type.ObjectDataType
-
-
Constructor Summary
Constructors Constructor Description ObjectDataType()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompare(Object a, Object b)Compare two keys.static intcompareNotNull(byte[] data1, byte[] data2)Compare the contents of two byte arrays.static Objectdeserialize(byte[] data)De-serialize the byte array to an object.intgetMemory(Object obj)Estimate the used memory in bytes.Objectread(ByteBuffer buff)Read an object.voidread(ByteBuffer buff, Object[] obj, int len, boolean key)Read a list of objects.static byte[]serialize(Object obj)Serialize the object to a byte array.voidwrite(WriteBuffer buff, Object obj)Write an object.voidwrite(WriteBuffer buff, Object[] obj, int len, boolean key)Write a list of objects.
-
-
-
Method Detail
-
compare
public int compare(Object a, Object b)
Description copied from interface:DataTypeCompare two keys.
-
getMemory
public int getMemory(Object obj)
Description copied from interface:DataTypeEstimate the used memory in bytes.
-
read
public void read(ByteBuffer buff, Object[] obj, int len, boolean key)
Description copied from interface:DataTypeRead a list of objects.
-
write
public void write(WriteBuffer buff, Object[] obj, int len, boolean key)
Description copied from interface:DataTypeWrite a list of objects.
-
write
public void write(WriteBuffer buff, Object obj)
Description copied from interface:DataTypeWrite an object.
-
read
public Object read(ByteBuffer buff)
Description copied from interface:DataTypeRead an object.
-
serialize
public static byte[] serialize(Object obj)
Serialize the object to a byte array.- Parameters:
obj- the object to serialize- Returns:
- the byte array
-
deserialize
public static Object deserialize(byte[] data)
De-serialize the byte array to an object.- Parameters:
data- the byte array- Returns:
- the object
-
compareNotNull
public static int compareNotNull(byte[] data1, byte[] data2)Compare the contents of two byte arrays. If the content or length of the first array is smaller than the second array, -1 is returned. If the content or length of the second array is smaller than the first array, 1 is returned. If the contents and lengths are the same, 0 is returned.This method interprets bytes as unsigned.
- Parameters:
data1- the first byte array (must not be null)data2- the second byte array (must not be null)- Returns:
- the result of the comparison (-1, 1 or 0)
-
-