Package org.apache.lucene.backward_codecs.packed

## Class LegacyDirectMonotonicWriter

- java.lang.Object
- - org.apache.lucene.backward_codecs.packed.LegacyDirectMonotonicWriter

-     public final class LegacyDirectMonotonicWriter
      extends Object

  Write monotonically-increasing sequences of integers. This writer splits data into blocks and then for each block, computes the average slope, the minimum value and only encode the delta from the expected value using a `LegacyDirectWriter`.
  See Also:
    `LegacyDirectMonotonicReader`
  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
    --- | --- | ---
    `static int` | `MAX_BLOCK_SHIFT` | max block shift
    `static int` | `MIN_BLOCK_SHIFT` | min block shift

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `add​(long v)` | Write a new value.
    `void` | `finish()` | This must be called exactly once after all values have been `added`.
    `static LegacyDirectMonotonicWriter` | `getInstance​(IndexOutput metaOut, IndexOutput dataOut, long numValues, int blockShift)` | Returns an instance suitable for encoding `numValues` into monotonic blocks of 2`blockShift` values.

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

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

- - ### Field Detail

    - #### MIN_BLOCK_SHIFT

          public static final int MIN_BLOCK_SHIFT

      min block shift
      See Also:
        Constant Field Values

    - #### MAX_BLOCK_SHIFT

          public static final int MAX_BLOCK_SHIFT

      max block shift
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### add

          public void add​(long v)
                   throws IOException

      Write a new value. Note that data might not make it to storage until `finish()` is called.
      Throws:
        `IllegalArgumentException` - if values don't come in order
        `IOException`

    - #### finish

          public void finish()
                      throws IOException

      This must be called exactly once after all values have been `added`.
      Throws:
        `IOException`

    - #### getInstance

          public static LegacyDirectMonotonicWriter getInstance​(IndexOutput metaOut,
                                                                IndexOutput dataOut,
                                                                long numValues,
                                                                int blockShift)

      Returns an instance suitable for encoding `numValues` into monotonic blocks of 2`blockShift` values. Metadata will be written to `metaOut` and actual data to `dataOut`.