org.h2.mvstore.type
Interface DataType

All Known Implementing Classes:
ObjectDataType, RowDataType, SpatialDataType, StringDataType, TransactionStore.ArrayType, TransactionStore.VersionedValueType, ValueDataType

public interface DataType

A data type.


Method Summary
 int compare(java.lang.Object a, java.lang.Object b)
          Compare two keys.
 int getMemory(java.lang.Object obj)
          Estimate the used memory in bytes.
 java.lang.Object read(java.nio.ByteBuffer buff)
          Read an object.
 void write(WriteBuffer buff, java.lang.Object obj)
          Write the object.
 

Method Detail

compare

int compare(java.lang.Object a,
            java.lang.Object b)
Compare two keys.

Parameters:
a - the first key
b - the second key
Returns:
-1 if the first key is smaller, 1 if larger, and 0 if equal
Throws:
java.lang.UnsupportedOperationException - if the type is not orderable

getMemory

int getMemory(java.lang.Object obj)
Estimate the used memory in bytes.

Parameters:
obj - the object
Returns:
the used memory

write

void write(WriteBuffer buff,
           java.lang.Object obj)
Write the object.

Parameters:
buff - the target buffer
obj - the value

read

java.lang.Object read(java.nio.ByteBuffer buff)
Read an object.

Parameters:
buff - the source buffer
Returns:
the object