Package org.apache.lucene.util

# Class IntsRefBuilder

java.lang.Object
org.apache.lucene.util.IntsRefBuilder

public class IntsRefBuilder extends Object
A builder for `IntsRef` instances.

NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `IntsRefBuilder()`
  Sole constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `append(int i)`
  Append the provided int to this buffer.
  `void`
  `clear()`
  Empty this builder.
  `void`
  `copyInts(int[] otherInts, int otherOffset, int otherLength)`
  Copies the given array into this instance.
  `void`
  `copyInts(IntsRef ints)`
  Copies the given array into this instance.
  `void`
  `copyUTF8Bytes(BytesRef bytes)`
  Copy the given UTF-8 bytes into this builder.
  `boolean`
  `equals(Object obj)`
  `IntsRef`
  `get()`
  Return a `IntsRef` that points to the internal content of this builder.
  `void`
  `grow(int newLength)`
  Used to grow the reference array.
  `void`
  `growNoCopy(int newLength)`
  Grow the reference array without copying the origin data to the new array.
  `int`
  `hashCode()`
  `int`
  `intAt(int offset)`
  Return the int at the given offset.
  `int[]`
  `ints()`
  Return a reference to the ints of this builder.
  `int`
  `length()`
  Return the number of ints in this buffer.
  `void`
  `setIntAt(int offset, int b)`
  Set an int.
  `void`
  `setLength(int length)`
  Set the length.
  `IntsRef`
  `toIntsRef()`
  Build a new `CharsRef` that has the same content as this builder.

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

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

- ## Constructor Details

  - ### IntsRefBuilder

    public IntsRefBuilder()
    Sole constructor.

- ## Method Details

  - ### ints

    public int[] ints()
    Return a reference to the ints of this builder.

  - ### length

    public int length()
    Return the number of ints in this buffer.

  - ### setLength

    public void setLength(int length)
    Set the length.

  - ### clear

    public void clear()
    Empty this builder.

  - ### intAt

    public int intAt(int offset)
    Return the int at the given offset.

  - ### setIntAt

    public void setIntAt(int offset, int b)
    Set an int.

  - ### append

    public void append(int i)
    Append the provided int to this buffer.

  - ### grow

    public void grow(int newLength)
    Used to grow the reference array.

    In general this should not be used as it does not take the offset into account.

    NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

  - ### growNoCopy

    public void growNoCopy(int newLength)
    Grow the reference array without copying the origin data to the new array.

  - ### copyInts

    public void copyInts(int[] otherInts, int otherOffset, int otherLength)
    Copies the given array into this instance.

  - ### copyInts

    public void copyInts(IntsRef ints)
    Copies the given array into this instance.

  - ### copyUTF8Bytes

    public void copyUTF8Bytes(BytesRef bytes)
    Copy the given UTF-8 bytes into this builder. Works as if the bytes were first converted from UTF-8 to UTF-32 and then copied into this builder.

  - ### get

    public IntsRef get()
    Return a `IntsRef` that points to the internal content of this builder. Any update to the content of this builder might invalidate the provided `ref` and vice-versa.

  - ### toIntsRef

    public IntsRef toIntsRef()
    Build a new `CharsRef` that has the same content as this builder.

  - ### equals

    public boolean equals(Object obj)
    Overrides:
      `equals` in class `Object`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`