Package 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
Description
`protected final int`
`initSize`

## Constructor Summary

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

## Method Summary

Modifier and Type
Method
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 Details

### initSize

protected final int initSize

## Constructor Details

### DirectBytesStartArray

public DirectBytesStartArray(int initSize, Counter counter)

### DirectBytesStartArray

public DirectBytesStartArray(int initSize)

## Method Details

### 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`.