Package org.h2.mvstore.type
Interface DataType<T>
- All Superinterfaces:
Comparator<T>
- All Known Implementing Classes:
BasicDataType
,ByteArrayDataType
,LobStorageMap.BlobMeta.Type
,LobStorageMap.BlobReference.Type
,LongDataType
,MetaType
,MVStoreTool.GenericDataType
,NullValueDataType
,ObjectDataType
,ObjectDataType.AutoDetectDataType
,ObjectDataType.BigDecimalType
,ObjectDataType.BigIntegerType
,ObjectDataType.BooleanType
,ObjectDataType.ByteType
,ObjectDataType.CharacterType
,ObjectDataType.DateType
,ObjectDataType.DoubleType
,ObjectDataType.FloatType
,ObjectDataType.IntegerType
,ObjectDataType.LongType
,ObjectDataType.NullType
,ObjectDataType.ObjectArrayType
,ObjectDataType.SerializedObjectType
,ObjectDataType.ShortType
,ObjectDataType.StringType
,ObjectDataType.UUIDType
,Record.Type
,RowDataType
,SpatialDataType
,StringDataType
,ValueDataType
,VersionedValueType
A data type.
-
Method Summary
Modifier and TypeMethodDescriptionint
binarySearch
(T key, Object storage, int size, int initialGuess) Perform binary search for the key within the storageint
Compare two keys.T[]
createStorage
(int size) Create storage object of array type to hold valuesint
Calculates the amount of used memory in bytes.boolean
Whether memory estimation based on previously seen values is allowed/desirableread
(ByteBuffer buff) Read an object.void
read
(ByteBuffer buff, Object storage, int len) Read a list of objects.void
write
(WriteBuffer buff, Object storage, int len) Write a list of objects.void
write
(WriteBuffer buff, T obj) Write an object.Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Method Details
-
compare
Compare two keys.- Specified by:
compare
in interfaceComparator<T>
- Parameters:
a
- the first keyb
- the second key- Returns:
- -1 if the first key is smaller, 1 if larger, and 0 if equal
- Throws:
UnsupportedOperationException
- if the type is not orderable
-
binarySearch
Perform binary search for the key within the storage- Parameters:
key
- to search forstorage
- to search within (an array of type T)size
- number of data items in the storageinitialGuess
- for key position- Returns:
- index of the key , if found, - index of the insertion point, if not
-
getMemory
Calculates the amount of used memory in bytes.- Parameters:
obj
- the object- Returns:
- the used memory
-
isMemoryEstimationAllowed
boolean isMemoryEstimationAllowed()Whether memory estimation based on previously seen values is allowed/desirable- Returns:
- true if memory estimation is allowed
-
write
Write an object.- Parameters:
buff
- the target bufferobj
- the value
-
write
Write a list of objects.- Parameters:
buff
- the target bufferstorage
- the objectslen
- the number of objects to write
-
read
Read an object.- Parameters:
buff
- the source buffer- Returns:
- the object
-
read
Read a list of objects.- Parameters:
buff
- the target bufferstorage
- the objectslen
- the number of objects to read
-
createStorage
Create storage object of array type to hold values- Parameters:
size
- number of values to hold- Returns:
- storage object
-