Interface DataType
-
- All Known Implementing Classes:
ObjectDataType,StringDataType
public interface DataTypeA data type.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intcompare(Object a, Object b)Compare two keys.intgetMemory(Object obj)Estimate the used memory in bytes.Objectread(ByteBuffer buff)Read an object.voidread(ByteBuffer buff, Object[] obj, int len, boolean key)Read a list of objects.voidwrite(WriteBuffer buff, Object obj)Write an object.voidwrite(WriteBuffer buff, Object[] obj, int len, boolean key)Write a list of objects.
-
-
-
Method Detail
-
compare
int compare(Object a, Object b)
Compare two keys.- 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
-
getMemory
int getMemory(Object obj)
Estimate the used memory in bytes.- Parameters:
obj- the object- Returns:
- the used memory
-
write
void write(WriteBuffer buff, Object obj)
Write an object.- Parameters:
buff- the target bufferobj- the value
-
write
void write(WriteBuffer buff, Object[] obj, int len, boolean key)
Write a list of objects.- Parameters:
buff- the target bufferobj- the objectslen- the number of objects to writekey- whether the objects are keys
-
read
Object read(ByteBuffer buff)
Read an object.- Parameters:
buff- the source buffer- Returns:
- the object
-
read
void read(ByteBuffer buff, Object[] obj, int len, boolean key)
Read a list of objects.- Parameters:
buff- the target bufferobj- the objectslen- the number of objects to readkey- whether the objects are keys
-
-