Class PagedGrowableWriter


public final class PagedGrowableWriter extends LongValues
A PagedGrowableWriter. This class slices data into fixed-size blocks which have independent numbers of bits per value and grow on-demand.

You should use this class instead of the AbstractAppendingLongBuffer related ones only when you need random write-access. Otherwise this class will likely be slower and less memory-efficient.

  • Constructor Details

    • PagedGrowableWriter

      public PagedGrowableWriter(long size, int pageSize, int startBitsPerValue, float acceptableOverheadRatio)
      Create a new PagedGrowableWriter instance.
      Parameters:
      size - the number of values to store.
      pageSize - the number of values per page
      startBitsPerValue - the initial number of bits per value
      acceptableOverheadRatio - an acceptable overhead ratio
  • Method Details

    • newMutable

      protected PackedInts.Mutable newMutable(int valueCount, int bitsPerValue)
    • newUnfilledCopy

      protected PagedGrowableWriter newUnfilledCopy(long newSize)
    • baseRamBytesUsed

      protected long baseRamBytesUsed()
    • fillPages

      protected final void fillPages()
    • size

      public final long size()
      The number of values.
    • get

      public final long get(long index)
      Description copied from class: LongValues
      Get value at index.
      Specified by:
      get in class LongValues
    • set

      public final void set(long index, long value)
      Set value at index.
    • ramBytesUsed

      public long ramBytesUsed()
      Return the number of bytes used by this object.
    • resize

      public final PagedGrowableWriter resize(long newSize)
      Create a new copy of size newSize based on the content of this buffer. This method is much more efficient than creating a new instance and copying values one by one.
    • grow

      public final PagedGrowableWriter grow(long minSize)
    • grow

      public final PagedGrowableWriter grow()
    • toString

      public final String toString()
      Overrides:
      toString in class Object