Package org.h2.mvstore
Class MVStoreTool.GenericDataType
- java.lang.Object
-
- org.h2.mvstore.type.BasicDataType<byte[]>
-
- org.h2.mvstore.MVStoreTool.GenericDataType
-
- All Implemented Interfaces:
java.util.Comparator<byte[]>,DataType<byte[]>
- Enclosing class:
- MVStoreTool
private static class MVStoreTool.GenericDataType extends BasicDataType<byte[]>
A data type that can read any data that is persisted, and converts it to a byte array.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static MVStoreTool.GenericDataTypeINSTANCE
-
Constructor Summary
Constructors Modifier Constructor Description privateGenericDataType()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[][]createStorage(int size)Create storage object of array type to hold valuesintgetMemory(byte[] obj)Calculates the amount of used memory in bytes.booleanisMemoryEstimationAllowed()Whether memory estimation based on previously seen values is allowed/desirablebyte[]read(java.nio.ByteBuffer buff)Read an object.voidwrite(WriteBuffer buff, byte[] obj)Write an object.-
Methods inherited from class org.h2.mvstore.type.BasicDataType
binarySearch, cast, compare, equals, hashCode, read, write
-
-
-
-
Field Detail
-
INSTANCE
static MVStoreTool.GenericDataType INSTANCE
-
-
Method Detail
-
isMemoryEstimationAllowed
public boolean isMemoryEstimationAllowed()
Description copied from interface:DataTypeWhether memory estimation based on previously seen values is allowed/desirable- Specified by:
isMemoryEstimationAllowedin interfaceDataType<byte[]>- Overrides:
isMemoryEstimationAllowedin classBasicDataType<byte[]>- Returns:
- true if memory estimation is allowed
-
getMemory
public int getMemory(byte[] obj)
Description copied from interface:DataTypeCalculates the amount of used memory in bytes.- Specified by:
getMemoryin interfaceDataType<byte[]>- Specified by:
getMemoryin classBasicDataType<byte[]>- Parameters:
obj- the object- Returns:
- the used memory
-
createStorage
public byte[][] 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
-
write
public void write(WriteBuffer buff, byte[] obj)
Description copied from interface:DataTypeWrite an object.- Specified by:
writein interfaceDataType<byte[]>- Specified by:
writein classBasicDataType<byte[]>- Parameters:
buff- the target bufferobj- the value
-
read
public byte[] read(java.nio.ByteBuffer buff)
Description copied from interface:DataTypeRead an object.- Specified by:
readin interfaceDataType<byte[]>- Specified by:
readin classBasicDataType<byte[]>- Parameters:
buff- the source buffer- Returns:
- the object
-
-