Class RangeBitmap.Appender

  • Enclosing class:
    RangeBitmap

    public static final class RangeBitmap.Appender
    extends java.lang.Object
    Builder for constructing immutable RangeBitmaps
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(long value)
      Adds the value and associates it with the current row index.
      RangeBitmap build()
      {@see #build(IntFunction)}
      RangeBitmap build​(java.nio.ByteBuffer buffer)
      Converts the appender into an immutable range index, using the supplied ByteBuffer.
      RangeBitmap build​(java.util.function.IntFunction<java.nio.ByteBuffer> supplier)
      Converts the appender into an immutable range index.
      void clear()
      Call this to reuse the appender and its buffers
      void serialize​(java.nio.ByteBuffer buffer)
      Serializes the bitmap to the buffer without materialising it.
      int serializedSizeInBytes()
      Returns the size of the RangeBitmap on disk.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • build

        public RangeBitmap build​(java.util.function.IntFunction<java.nio.ByteBuffer> supplier)
        Converts the appender into an immutable range index.
        Parameters:
        supplier - provides an appropriate ByteBuffer to store into
        Returns:
        a queriable RangeBitmap
      • build

        public RangeBitmap build()
        {@see #build(IntFunction)}
      • build

        public RangeBitmap build​(java.nio.ByteBuffer buffer)
        Converts the appender into an immutable range index, using the supplied ByteBuffer.
        Parameters:
        buffer - a little endian buffer which must have sufficient capacity for the appended values.
        Returns:
        a queriable RangeBitmap
      • clear

        public void clear()
        Call this to reuse the appender and its buffers
      • serializedSizeInBytes

        public int serializedSizeInBytes()
        Returns the size of the RangeBitmap on disk.
        Returns:
        the serialized size in bytes.
      • serialize

        public void serialize​(java.nio.ByteBuffer buffer)
        Serializes the bitmap to the buffer without materialising it. The user should call {@see serializedSizeInBytes} to size the buffer appropriately.

        It is not guaranteed that all values will be written

        Parameters:
        buffer - expected to be large enough to contain the bitmap.
      • add

        public void add​(long value)
        Adds the value and associates it with the current row index.
        Parameters:
        value - the value, will be rejected if greater than max value.