org.apache.lucene.util.bkd

## Class HeapPointWriter

- java.lang.Object
- - org.apache.lucene.util.bkd.HeapPointWriter

- All Implemented Interfaces:
    Closeable, AutoCloseable, PointWriter

      public final class HeapPointWriter
      extends Object
      implements PointWriter

  Utility class to write new points into in-heap arrays.
  NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `byte[]` | `block`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `HeapPointWriter(int size, int packedBytesLength)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `append(byte[] packedValue, int docID)` Add a new point from the packed value and docId
    `void` | `append(PointValue pointValue)` Add a new point from a `PointValue`
    `void` | `close()`
    `int` | `computeCardinality(int from, int to, int numDataDims, int bytesPerDim, int[] commonPrefixLengths)`
    `long` | `count()` Return the number of points in this writer
    `void` | `destroy()` Removes any temp files behind this writer
    `PointValue` | `getPackedValueSlice(int index)` Returns a reference, in `result`, to the byte[] slice holding this value
    `PointReader` | `getReader(long start, long length)` Returns a `PointReader` iterator to step through all previously added points
    `void` | `swap(int i, int j)`
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### block

          public final byte[] block

  - ### Constructor Detail

    - #### HeapPointWriter

          public HeapPointWriter(int size,
                                 int packedBytesLength)

  - ### Method Detail

    - #### getPackedValueSlice

          public PointValue getPackedValueSlice(int index)

      Returns a reference, in `result`, to the byte[] slice holding this value

    - #### append

          public void append(byte[] packedValue,
                             int docID)

      Description copied from interface: `PointWriter`
      Add a new point from the packed value and docId
      Specified by:
        `append` in interface `PointWriter`

    - #### append

          public void append(PointValue pointValue)

      Description copied from interface: `PointWriter`
      Add a new point from a `PointValue`
      Specified by:
        `append` in interface `PointWriter`

    - #### swap

          public void swap(int i,
                           int j)

    - #### computeCardinality

          public int computeCardinality(int from,
                                        int to,
                                        int numDataDims,
                                        int bytesPerDim,
                                        int[] commonPrefixLengths)

    - #### count

          public long count()

      Description copied from interface: `PointWriter`
      Return the number of points in this writer
      Specified by:
        `count` in interface `PointWriter`

    - #### getReader

          public PointReader getReader(long start,
                                       long length)

      Description copied from interface: `PointWriter`
      Returns a `PointReader` iterator to step through all previously added points
      Specified by:
        `getReader` in interface `PointWriter`

    - #### close

          public void close()

      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`

    - #### destroy

          public void destroy()

      Description copied from interface: `PointWriter`
      Removes any temp files behind this writer
      Specified by:
        `destroy` in interface `PointWriter`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

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