Package org.h2.mvstore.type
Class StringDataType
- All Implemented Interfaces:
Comparator<String>
,DataType<String>
A string type.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
binarySearch
(String key, Object storageObj, int size, int initialGuess) Perform binary search for the key within the storageint
Compare two keys.String[]
createStorage
(int size) Create storage object of array type to hold valuesint
Calculates the amount of used memory in bytes.read
(ByteBuffer buff) Read an object.void
write
(WriteBuffer buff, String s) Write an object.Methods inherited from class org.h2.mvstore.type.BasicDataType
cast, equals, hashCode, isMemoryEstimationAllowed, read, write
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
INSTANCE
-
EMPTY_STRING_ARR
-
-
Constructor Details
-
StringDataType
public StringDataType()
-
-
Method Details
-
createStorage
Description copied from interface:DataType
Create storage object of array type to hold values- Parameters:
size
- number of values to hold- Returns:
- storage object
-
compare
Description copied from interface:DataType
Compare two keys.- Specified by:
compare
in interfaceComparator<String>
- Specified by:
compare
in interfaceDataType<String>
- Overrides:
compare
in classBasicDataType<String>
- Parameters:
a
- the first keyb
- the second key- Returns:
- -1 if the first key is smaller, 1 if larger, and 0 if equal
-
binarySearch
Description copied from interface:DataType
Perform binary search for the key within the storage- Specified by:
binarySearch
in interfaceDataType<String>
- Overrides:
binarySearch
in classBasicDataType<String>
- Parameters:
key
- to search forstorageObj
- 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
Description copied from interface:DataType
Calculates the amount of used memory in bytes. -
read
Description copied from interface:DataType
Read an object. -
write
Description copied from interface:DataType
Write an object.
-