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 int
compare(Object a, Object b)
Compare two keys.static int
compareNotNull(byte[] data1, byte[] data2)
Compare the contents of two byte arrays.static Object
deserialize(byte[] data)
De-serialize the byte array to an object.int
getMemory(Object obj)
Estimate the used memory in bytes.Object
read(ByteBuffer buff)
Read an object.void
read(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.void
write(WriteBuffer buff, Object obj)
Write an object.void
write(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:DataType
Compare two keys.
-
getMemory
public int getMemory(Object obj)
Description copied from interface:DataType
Estimate the used memory in bytes.
-
read
public void read(ByteBuffer buff, Object[] obj, int len, boolean key)
Description copied from interface:DataType
Read a list of objects.
-
write
public void write(WriteBuffer buff, Object[] obj, int len, boolean key)
Description copied from interface:DataType
Write a list of objects.
-
write
public void write(WriteBuffer buff, Object obj)
Description copied from interface:DataType
Write an object.
-
read
public Object read(ByteBuffer buff)
Description copied from interface:DataType
Read 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)
-
-