org.apache.lucene.util

## Class BytesRefHash.DirectBytesStartArray

- java.lang.Object
- - org.apache.lucene.util.BytesRefHash.BytesStartArray
  - - org.apache.lucene.util.BytesRefHash.DirectBytesStartArray

- Enclosing class:
    BytesRefHash

      public static class BytesRefHash.DirectBytesStartArray
      extends BytesRefHash.BytesStartArray

  A simple `BytesRefHash.BytesStartArray` that tracks memory allocation using a private `Counter` instance.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected int` | `initSize`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DirectBytesStartArray(int initSize)`
    `DirectBytesStartArray(int initSize, Counter counter)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Counter` | `bytesUsed()` A `Counter` reference holding the number of bytes used by this `BytesRefHash.BytesStartArray`.
    `int[]` | `clear()` clears the `BytesRefHash.BytesStartArray` and returns the cleared instance.
    `int[]` | `grow()` Grows the `BytesRefHash.BytesStartArray`
    `int[]` | `init()` Initializes the BytesStartArray.

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

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

- - ### Field Detail

    - #### initSize

          protected final int initSize

  - ### Constructor Detail

    - #### DirectBytesStartArray

          public DirectBytesStartArray(int initSize,
                                       Counter counter)

    - #### DirectBytesStartArray

          public DirectBytesStartArray(int initSize)

  - ### Method Detail

    - #### clear

          public int[] clear()

      Description copied from class: `BytesRefHash.BytesStartArray`
      clears the `BytesRefHash.BytesStartArray` and returns the cleared instance.
      Specified by:
        `clear` in class `BytesRefHash.BytesStartArray`
      Returns:
        the cleared instance, this might be `null`

    - #### grow

          public int[] grow()

      Description copied from class: `BytesRefHash.BytesStartArray`
      Grows the `BytesRefHash.BytesStartArray`
      Specified by:
        `grow` in class `BytesRefHash.BytesStartArray`
      Returns:
        the grown array

    - #### init

          public int[] init()

      Description copied from class: `BytesRefHash.BytesStartArray`
      Initializes the BytesStartArray. This call will allocate memory
      Specified by:
        `init` in class `BytesRefHash.BytesStartArray`
      Returns:
        the initialized bytes start array

    - #### bytesUsed

          public Counter bytesUsed()

      Description copied from class: `BytesRefHash.BytesStartArray`
      A `Counter` reference holding the number of bytes used by this `BytesRefHash.BytesStartArray`. The `BytesRefHash` uses this reference to track it memory usage
      Specified by:
        `bytesUsed` in class `BytesRefHash.BytesStartArray`
      Returns:
        a `AtomicLong` reference holding the number of bytes used by this `BytesRefHash.BytesStartArray`.

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