Package org.h2.mvstore.type
Class ObjectDataType.SerializedObjectType
- java.lang.Object
-
- org.h2.mvstore.type.BasicDataType<T>
-
- org.h2.mvstore.type.ObjectDataType.AutoDetectDataType<java.lang.Object>
-
- org.h2.mvstore.type.ObjectDataType.SerializedObjectType
-
- All Implemented Interfaces:
java.util.Comparator<java.lang.Object>,DataType<java.lang.Object>
- Enclosing class:
- ObjectDataType
static class ObjectDataType.SerializedObjectType extends ObjectDataType.AutoDetectDataType<java.lang.Object>
The type for serialized objects.
-
-
Field Summary
Fields Modifier and Type Field Description private intaverageSize-
Fields inherited from class org.h2.mvstore.type.ObjectDataType.AutoDetectDataType
typeId
-
-
Constructor Summary
Constructors Constructor Description SerializedObjectType(ObjectDataType base)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompare(java.lang.Object aObj, java.lang.Object bObj)Compare two keys.java.lang.Object[]createStorage(int size)Create storage object of array type to hold valuesintgetMemory(java.lang.Object obj)Calculates the amount of used memory in bytes.java.lang.Objectread(java.nio.ByteBuffer buff)Read an object.java.lang.Objectread(java.nio.ByteBuffer buff, int tag)Read an object from the buffer.voidwrite(WriteBuffer buff, java.lang.Object obj)Write an object.-
Methods inherited from class org.h2.mvstore.type.ObjectDataType.AutoDetectDataType
getType
-
Methods inherited from class org.h2.mvstore.type.BasicDataType
binarySearch, cast, equals, hashCode, isMemoryEstimationAllowed, read, write
-
-
-
-
Constructor Detail
-
SerializedObjectType
SerializedObjectType(ObjectDataType base)
-
-
Method Detail
-
createStorage
public java.lang.Object[] createStorage(int size)
Description copied from interface:DataTypeCreate storage object of array type to hold values- Parameters:
size- number of values to hold- Returns:
- storage object
-
compare
public int compare(java.lang.Object aObj, java.lang.Object bObj)Description copied from interface:DataTypeCompare two keys.- Specified by:
comparein interfacejava.util.Comparator<java.lang.Object>- Specified by:
comparein interfaceDataType<java.lang.Object>- Overrides:
comparein classBasicDataType<java.lang.Object>- Parameters:
aObj- the first keybObj- the second key- Returns:
- -1 if the first key is smaller, 1 if larger, and 0 if equal
-
getMemory
public int getMemory(java.lang.Object obj)
Description copied from interface:DataTypeCalculates the amount of used memory in bytes.- Specified by:
getMemoryin interfaceDataType<java.lang.Object>- Overrides:
getMemoryin classObjectDataType.AutoDetectDataType<java.lang.Object>- Parameters:
obj- the object- Returns:
- the used memory
-
write
public void write(WriteBuffer buff, java.lang.Object obj)
Description copied from interface:DataTypeWrite an object.- Specified by:
writein interfaceDataType<java.lang.Object>- Overrides:
writein classObjectDataType.AutoDetectDataType<java.lang.Object>- Parameters:
buff- the target bufferobj- the value
-
read
public java.lang.Object read(java.nio.ByteBuffer buff)
Description copied from interface:DataTypeRead an object.- Specified by:
readin interfaceDataType<java.lang.Object>- Specified by:
readin classBasicDataType<java.lang.Object>- Parameters:
buff- the source buffer- Returns:
- the object
-
read
public java.lang.Object read(java.nio.ByteBuffer buff, int tag)Description copied from class:ObjectDataType.AutoDetectDataTypeRead an object from the buffer.- Specified by:
readin classObjectDataType.AutoDetectDataType<java.lang.Object>- Parameters:
buff- the buffertag- the first byte of the object (usually the type)- Returns:
- the read object
-
-