Class ByteArrayDataType

  • All Implemented Interfaces:
    java.util.Comparator<byte[]>, DataType<byte[]>

    public final class ByteArrayDataType
    extends BasicDataType<byte[]>
    Class ByteArrayDataType.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compare​(byte[] one, byte[] two)
      Compare two keys.
      byte[][] createStorage​(int size)
      Create storage object of array type to hold values
      int getMemory​(byte[] data)
      Calculates the amount of used memory in bytes.
      byte[] read​(java.nio.ByteBuffer buff)
      Read an object.
      void write​(WriteBuffer buff, byte[] data)
      Write an object.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Comparator

        reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
    • Method Detail

      • getMemory

        public int getMemory​(byte[] data)
        Description copied from interface: DataType
        Calculates the amount of used memory in bytes.
        Specified by:
        getMemory in interface DataType<byte[]>
        Specified by:
        getMemory in class BasicDataType<byte[]>
        Parameters:
        data - the object
        Returns:
        the used memory
      • write

        public void write​(WriteBuffer buff,
                          byte[] data)
        Description copied from interface: DataType
        Write an object.
        Specified by:
        write in interface DataType<byte[]>
        Specified by:
        write in class BasicDataType<byte[]>
        Parameters:
        buff - the target buffer
        data - the value
      • read

        public byte[] read​(java.nio.ByteBuffer buff)
        Description copied from interface: DataType
        Read an object.
        Specified by:
        read in interface DataType<byte[]>
        Specified by:
        read in class BasicDataType<byte[]>
        Parameters:
        buff - the source buffer
        Returns:
        the object
      • createStorage

        public byte[][] createStorage​(int size)
        Description copied from interface: DataType
        Create storage object of array type to hold values
        Parameters:
        size - number of values to hold
        Returns:
        storage object
      • compare

        public int compare​(byte[] one,
                           byte[] two)
        Description copied from interface: DataType
        Compare two keys.
        Specified by:
        compare in interface java.util.Comparator<byte[]>
        Specified by:
        compare in interface DataType<byte[]>
        Overrides:
        compare in class BasicDataType<byte[]>
        Parameters:
        one - the first key
        two - the second key
        Returns:
        -1 if the first key is smaller, 1 if larger, and 0 if equal