All Known Implementing Classes:
ObjectDataType, StringDataType

public interface DataType
A data type.
  • Method Details

    • compare

      int compare(Object a, 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:
      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 buffer
      obj - the value
    • write

      void write(WriteBuffer buff, 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

      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 buffer
      obj - the objects
      len - the number of objects to read
      key - whether the objects are keys