Overview | Package | Class | Use | Tree | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.lucene.util.packed
Class PagedGrowableWriter

    java.lang.Object
      org.apache.lucene.util.packed.PagedGrowableWriter

    public final class PagedGrowableWriter

extends Object

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 `AppendingLongBuffer` only when you need random write-access. Otherwise this class will likely be slower and less memory-efficient.

NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

Constructor Summary
`PagedGrowableWriter(long size, int pageSize, int startBitsPerValue, float acceptableOverheadRatio)` Create a new `PagedGrowableWriter` instance.

Method Summary
`protected long` | `baseRamBytesUsed()`
`protected void` | `fillPages()`
`long` | `get(long index)` Get value at `index`.
`T` | `grow()` Similar to `ArrayUtil.grow(long[])`.
`T` | `grow(long minSize)` Similar to `ArrayUtil.grow(long[], int)`.
`protected PackedInts.Mutable` | `newMutable(int valueCount, int bitsPerValue)`
`protected PagedGrowableWriter` | `newUnfilledCopy(long newSize)`
`long` | `ramBytesUsed()` Return the number of bytes used by this object.
`T` | `resize(long newSize)` Create a new copy of size `newSize` based on the content of this buffer.
`void` | `set(long index, long value)` Set value at `index`.
`long` | `size()` The number of values.
`String` | `toString()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### 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 Detail

### 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)

  Get value at `index`.

### 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 T 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 T grow(long minSize)

  Similar to `ArrayUtil.grow(long[], int)`.

### grow

    public final T grow()

  Similar to `ArrayUtil.grow(long[])`.

### toString

    public final String toString()

  Overrides:
    `toString` in class `Object`

Overview | Package | Class | Use | Tree | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.