GrowableWriter

class GrowableWriter(startBitsPerValue: Int, valueCount: Int, acceptableOverheadRatio: Float) : PackedInts.Mutable

Implements PackedInts.Mutable, but grows the bit count of the underlying packed ints on-demand.

Beware that this class will accept to set negative values but in order to do this, it will grow the number of bits per value to 64.

Constructors

Link copied to clipboard
constructor(startBitsPerValue: Int, valueCount: Int, acceptableOverheadRatio: Float)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val bitsPerValue: Int
Link copied to clipboard

Returns nested resources of this class. The result should be a point-in-time snapshot (to avoid race conditions).

Link copied to clipboard

Functions

Link copied to clipboard
open override fun clear()

Sets all values to 0.

Link copied to clipboard
open override fun fill(fromIndex: Int, toIndex: Int, val: Long)

Fill the mutable from fromIndex (inclusive) to toIndex (exclusive) with val.

Link copied to clipboard
open override fun get(index: Int): Long

Get the long at the given index. Behavior is undefined for out-of-range indices.

open override fun get(index: Int, arr: LongArray, off: Int, len: Int): Int

Bulk get: read at least one and at most len longs starting from index * into arr[off:off+len] and return the actual number of values that have been read.

Link copied to clipboard
open override fun ramBytesUsed(): Long

Return the memory usage of this object in bytes. Negative values are illegal.

Link copied to clipboard
fun resize(newSize: Int): GrowableWriter
Link copied to clipboard
open override fun set(index: Int, value: Long)

Set the value at the given index in the array.

open override fun set(index: Int, arr: LongArray, off: Int, len: Int): Int

Bulk set: set at least one and at most len longs starting at off in arr into this mutable, starting at index. Returns the actual number of values that have been set.

Link copied to clipboard
open override fun size(): Int