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 and Description
    --- | ---
    `String` | `name`
    `IndexOutput` | `out`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `OfflinePointWriter(Directory tempDir, String tempFileNamePrefix, int packedBytesLength, boolean longOrds, String desc, long expectedCount, boolean singleValuePerDoc)` Create a new writer with an unknown number of incoming points
    `OfflinePointWriter(Directory tempDir, String name, int packedBytesLength, long count, boolean longOrds, boolean singleValuePerDoc)` Initializes on an already written/closed file, just so consumers can use `getReader(long, long)` to read the file.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `append(byte[] packedValue, long ord, int docID)` Add a new point
    `void` | `close()`
    `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
    `PointReader` | `getSharedReader(long start, long length, List<Closeable> toCloseHeroically)` Returns the single shared reader, used at multiple times during the recursion, to read previously added points
    `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(Directory tempDir,
                                    String tempFileNamePrefix,
                                    int packedBytesLength,
                                    boolean longOrds,
                                    String desc,
                                    long expectedCount,
                                    boolean singleValuePerDoc)
                             throws IOException

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

    - #### OfflinePointWriter

          public OfflinePointWriter(Directory tempDir,
                                    String name,
                                    int packedBytesLength,
                                    long count,
                                    boolean longOrds,
                                    boolean singleValuePerDoc)

      Initializes on an already written/closed file, just so consumers can use `getReader(long, long)` to read the file.

  - ### Method Detail

    - #### append

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

      Description copied from interface: `PointWriter`
      Add a new point
      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`

    - #### getSharedReader

          public PointReader getSharedReader(long start,
                                             long length,
                                             List<Closeable> toCloseHeroically)
                                      throws IOException

      Description copied from interface: `PointWriter`
      Returns the single shared reader, used at multiple times during the recursion, to read previously added points
      Specified by:
        `getSharedReader` in interface `PointWriter`
      Throws:
        `IOException`

    - #### close

          public void close()
                     throws IOException

      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`
      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`

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