Class StringDataType

  • All Implemented Interfaces:
    DataType

    public class StringDataType
    extends Object
    implements DataType
    A string type.
    • Constructor Detail

      • StringDataType

        public StringDataType()
    • Method Detail

      • compare

        public int compare​(Object a,
                           Object b)
        Description copied from interface: DataType
        Compare two keys.
        Specified by:
        compare in interface DataType
        Parameters:
        a - the first key
        b - the second key
        Returns:
        -1 if the first key is smaller, 1 if larger, and 0 if equal
      • getMemory

        public int getMemory​(Object obj)
        Description copied from interface: DataType
        Estimate the used memory in bytes.
        Specified by:
        getMemory in interface DataType
        Parameters:
        obj - the object
        Returns:
        the used memory
      • read

        public void read​(ByteBuffer buff,
                         Object[] obj,
                         int len,
                         boolean key)
        Description copied from interface: DataType
        Read a list of objects.
        Specified by:
        read in interface DataType
        Parameters:
        buff - the target buffer
        obj - the objects
        len - the number of objects to read
        key - whether the objects are keys
      • write

        public void write​(WriteBuffer buff,
                          Object[] obj,
                          int len,
                          boolean key)
        Description copied from interface: DataType
        Write a list of objects.
        Specified by:
        write in interface DataType
        Parameters:
        buff - the target buffer
        obj - the objects
        len - the number of objects to write
        key - whether the objects are keys
      • read

        public String read​(ByteBuffer buff)
        Description copied from interface: DataType
        Read an object.
        Specified by:
        read in interface DataType
        Parameters:
        buff - the source buffer
        Returns:
        the object
      • write

        public void write​(WriteBuffer buff,
                          Object obj)
        Description copied from interface: DataType
        Write an object.
        Specified by:
        write in interface DataType
        Parameters:
        buff - the target buffer
        obj - the value