Class MVStoreTool.GenericDataType

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

    private static class MVStoreTool.GenericDataType
    extends BasicDataType<byte[]>
    A data type that can read any data that is persisted, and converts it to a byte array.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private GenericDataType()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[][] createStorage​(int size)
      Create storage object of array type to hold values
      int getMemory​(byte[] obj)
      Calculates the amount of used memory in bytes.
      boolean isMemoryEstimationAllowed()
      Whether memory estimation based on previously seen values is allowed/desirable
      byte[] read​(java.nio.ByteBuffer buff)
      Read an object.
      void write​(WriteBuffer buff, byte[] obj)
      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
    • Constructor Detail

      • GenericDataType

        private GenericDataType()
    • Method Detail

      • getMemory

        public int getMemory​(byte[] obj)
        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:
        obj - the object
        Returns:
        the used memory
      • 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
      • write

        public void write​(WriteBuffer buff,
                          byte[] obj)
        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
        obj - 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