BlockHeader (Lucene 10.5.0 codecs API)
Description: declaration: package: org.apache.lucene.codecs.uniformsplit, class: BlockHeader

Package org.apache.lucene.codecs.uniformsplit

# Class BlockHeader

java.lang.Object
org.apache.lucene.codecs.uniformsplit.BlockHeader

All Implemented Interfaces:
  `Accountable`

public class BlockHeader extends Object implements Accountable
Block header containing block metadata.

Holds the number of lines in the block.

Holds the base file pointers to apply delta base encoding to all the file pointers in the block with `DeltaBaseTermStateSerializer`.

Holds the offset to the details region of the block (the term states).

Holds the offset to the middle term of the block to divide the number of terms to scan by 2.

WARNING: This API is experimental and might change in incompatible ways in the next release.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `BlockHeader.Serializer`
  Reads/writes block header.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected long`
  `baseDocsFP`
  `protected long`
  `basePayloadsFP`
  `protected long`
  `basePositionsFP`
  `protected int`
  `linesCount`
  `protected int`
  `middleLineIndex`
  `protected int`
  `middleLineOffset`
  `protected int`
  `termStatesBaseOffset`

  ### Fields inherited from interface org.apache.lucene.util.Accountable

  `NULL_ACCOUNTABLE`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `BlockHeader()`
  Empty constructor.
  `protected`
  `BlockHeader(int linesCount, long baseDocsFP, long basePositionsFP, long basePayloadsFP, int termStatesBaseOffset, int middleLineOffset)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `long`
  `getBaseDocsFP()`
  `long`
  `getBasePayloadsFP()`
  `long`
  `getBasePositionsFP()`
  `int`
  `getLinesCount()`
  `int`
  `getMiddleLineIndex()`
  `int`
  `getMiddleLineOffset()`
  `int`
  `getTermStatesBaseOffset()`
  `long`
  `ramBytesUsed()`
  `protected BlockHeader`
  `reset(int linesCount, long baseDocsFP, long basePositionsFP, long basePayloadsFP, int termStatesBaseOffset, int middleTermOffset)`

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

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

  ### Methods inherited from interface org.apache.lucene.util.Accountable

  `getChildResources`

- ## Field Details

  - ### linesCount

    protected int linesCount

  - ### baseDocsFP

    protected long baseDocsFP

  - ### basePositionsFP

    protected long basePositionsFP

  - ### basePayloadsFP

    protected long basePayloadsFP

  - ### termStatesBaseOffset

    protected int termStatesBaseOffset

  - ### middleLineIndex

    protected int middleLineIndex

  - ### middleLineOffset

    protected int middleLineOffset

- ## Constructor Details

  - ### BlockHeader

    protected BlockHeader(int linesCount, long baseDocsFP, long basePositionsFP, long basePayloadsFP, int termStatesBaseOffset, int middleLineOffset)
    Parameters:
      `linesCount` - Number of lines in the block.
      `baseDocsFP` - File pointer to the docs of the first term with docs in the block.
      `basePositionsFP` - File pointer to the positions of the first term with positions in the block.
      `basePayloadsFP` - File pointer to the payloads of the first term with payloads in the block.
      `termStatesBaseOffset` - Offset to the details region of the block (the term states), relative to the block start.
      `middleLineOffset` - Offset to the middle term of the block, relative to the block start.

  - ### BlockHeader

    protected BlockHeader()
    Empty constructor. `reset(int, long, long, long, int, int)` must be called before writing.

- ## Method Details

  - ### reset

    protected BlockHeader reset(int linesCount, long baseDocsFP, long basePositionsFP, long basePayloadsFP, int termStatesBaseOffset, int middleTermOffset)

  - ### getLinesCount

    public int getLinesCount()
    Returns:
      The number of lines in the block.

  - ### getMiddleLineIndex

    public int getMiddleLineIndex()
    Returns:
      The index of the middle line of the block.

  - ### getMiddleLineOffset

    public int getMiddleLineOffset()
    Returns:
      The offset to the middle line of the block, relative to the block start.

  - ### getTermStatesBaseOffset

    public int getTermStatesBaseOffset()
    Returns:
      The offset to the details region of the block (the term states), relative to the block start.

  - ### getBaseDocsFP

    public long getBaseDocsFP()
    Returns:
      The file pointer to the docs of the first term with docs in the block.

  - ### getBasePositionsFP

    public long getBasePositionsFP()
    Returns:
      The file pointer to the positions of the first term with positions in the block.

  - ### getBasePayloadsFP

    public long getBasePayloadsFP()
    Returns:
      The file pointer to the payloads of the first term with payloads in the block.

  - ### ramBytesUsed

    public long ramBytesUsed()
    Specified by:
      `ramBytesUsed` in interface `Accountable`