Class ObjectDataType
java.lang.Object
org.dizitart.no2.mvstore.compat.v1.mvstore.type.ObjectDataType
- All Implemented Interfaces:
DataType
A data type implementation for the most common data types, including
serializable objects.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintCompare 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.intEstimate the used memory in bytes.read(ByteBuffer buff) Read an object.voidread(ByteBuffer buff, Object[] obj, int len, boolean key) Read a list of objects.static byte[]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.
-
Constructor Details
-
ObjectDataType
public ObjectDataType()
-
-
Method Details
-
compare
Description copied from interface:DataTypeCompare two keys. -
getMemory
Description copied from interface:DataTypeEstimate the used memory in bytes. -
read
Description copied from interface:DataTypeRead a list of objects. -
write
Description copied from interface:DataTypeWrite a list of objects. -
write
Description copied from interface:DataTypeWrite an object. -
read
Description copied from interface:DataTypeRead an object. -
serialize
Serialize the object to a byte array.- Parameters:
obj- the object to serialize- Returns:
- the byte array
-
deserialize
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)
-