Package org.apache.lucene.util.bkd

## Class OfflinePointWriter

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

- All Implemented Interfaces:
    `Closeable`, `AutoCloseable`, `PointWriter`

      public final class OfflinePointWriter
      extends Object
      implements PointWriter

  Writes points to disk in a fixed-with format.
  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 | Description
    --- | --- | ---
    `String` | `name` |
    `IndexOutput` | `out` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `OfflinePointWriter​(BKDConfig config, Directory tempDir, String tempFileNamePrefix, String desc, long expectedCount)` | Create a new writer with an unknown number of incoming points

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | 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()` |
    `long` | `count()` | Return the number of points in this writer
    `void` | `destroy()` | Removes any temp files behind this writer
    `PointReader` | `getReader​(long start, long length)` | Returns a `PointReader` iterator to step through all previously added points
    `protected OfflinePointReader` | `getReader​(long start, long length, byte[] reusableBuffer)` |
    `String` | `toString()` |

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

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

- - ### Field Detail

    - #### out

          public final IndexOutput out

    - #### name

          public final String name

  - ### Constructor Detail

    - #### OfflinePointWriter

          public OfflinePointWriter​(BKDConfig config,
                                    Directory tempDir,
                                    String tempFileNamePrefix,
                                    String desc,
                                    long expectedCount)
                             throws IOException

      Create a new writer with an unknown number of incoming points
      Throws:
        `IOException`

  - ### Method Detail

    - #### append

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

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

    - #### append

          public void append​(PointValue pointValue)
                      throws IOException

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

    - #### getReader

          public PointReader getReader​(long start,
                                       long length)
                                throws IOException

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

    - #### getReader

          protected OfflinePointReader getReader​(long start,
                                                 long length,
                                                 byte[] reusableBuffer)
                                          throws IOException

      Throws:
        `IOException`

    - #### count

          public long count()

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

    - #### close

          public void close()
                     throws IOException

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

    - #### destroy

          public void destroy()
                       throws IOException

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

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`