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 read(java.nio.ByteBuffer buff, java.lang.Object[] obj, int len, boolean key)
          Read a list of objects.
 void write(WriteBuffer buff, java.lang.Object obj)
          Write an object.
 void write(WriteBuffer buff, java.lang.Object[] obj, int len, boolean key)
          Write a list of objects.
 

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 an object.

Parameters:
buff - the target buffer
obj - the value

write

void write(WriteBuffer buff,
           java.lang.Object[] obj,
           int len,
           boolean key)
Write a list of objects.

Parameters:
buff - the target buffer
obj - the objects
len - the number of objects to write
key - whether the objects are keys

read

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

Parameters:
buff - the source buffer
Returns:
the object

read

void read(java.nio.ByteBuffer buff,
          java.lang.Object[] obj,
          int len,
          boolean key)
Read a list of objects.

Parameters:
buff - the target buffer
obj - the objects
len - the number of objects to read
key - whether the objects are keys