Package org.h2.mvstore.type
Class ByteArrayDataType
java.lang.Object
org.h2.mvstore.type.BasicDataType<byte[]>
org.h2.mvstore.type.ByteArrayDataType
- All Implemented Interfaces:
Comparator<byte[]>,DataType<byte[]>
Class ByteArrayDataType.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionintcompare(byte[] one, byte[] two) Compare two keys.byte[][]createStorage(int size) Create storage object of array type to hold valuesintgetMemory(byte[] data) Calculates the amount of used memory in bytes.byte[]read(ByteBuffer buff) Read an object.voidwrite(WriteBuffer buff, byte[] data) Write an object.Methods inherited from class org.h2.mvstore.type.BasicDataType
binarySearch, cast, equals, hashCode, isMemoryEstimationAllowed, read, writeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
INSTANCE
-
-
Method Details
-
getMemory
public int getMemory(byte[] data) Description copied from interface:DataTypeCalculates the amount of used memory in bytes.- Specified by:
getMemoryin interfaceDataType<byte[]>- Specified by:
getMemoryin classBasicDataType<byte[]>- Parameters:
data- the object- Returns:
- the used memory
-
write
Description copied from interface:DataTypeWrite an object.- Specified by:
writein interfaceDataType<byte[]>- Specified by:
writein classBasicDataType<byte[]>- Parameters:
buff- the target bufferdata- the value
-
read
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
-
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
-
compare
public int compare(byte[] one, byte[] two) Description copied from interface:DataTypeCompare two keys.- Specified by:
comparein interfaceComparator<byte[]>- Specified by:
comparein interfaceDataType<byte[]>- Overrides:
comparein classBasicDataType<byte[]>- Parameters:
one- the first keytwo- the second key- Returns:
- -1 if the first key is smaller, 1 if larger, and 0 if equal
-