OfflineSorter.ByteSequencesReader (Lucene 10.5.0 core API)
Description: declaration: package: org.apache.lucene.util, class: OfflineSorter, class: ByteSequencesReader

Package org.apache.lucene.util

# Class OfflineSorter.ByteSequencesReader

java.lang.Object
org.apache.lucene.util.OfflineSorter.ByteSequencesReader

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`, `BytesRefIterator`

Enclosing class:
  `OfflineSorter`

public static class OfflineSorter.ByteSequencesReader extends Object implements BytesRefIterator, Closeable
Utility class to read length-prefixed byte[] entries from an input. Complementary to `OfflineSorter.ByteSequencesWriter`.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final long`
  `end`
  `protected final ChecksumIndexInput`
  `in`
  `protected final String`
  `name`
  `protected final BytesRefBuilder`
  `ref`

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

  `EMPTY`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ByteSequencesReader(ChecksumIndexInput in, String name)`
  Constructs a ByteSequencesReader from the provided IndexInput

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  Closes the provided `IndexInput`.
  `BytesRef`
  `next()`
  Reads the next entry into the provided `BytesRef`.

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

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

- ## Field Details

  - ### name

    protected final String name

  - ### in

    protected final ChecksumIndexInput in

  - ### end

    protected final long end

  - ### ref

    protected final BytesRefBuilder ref

- ## Constructor Details

  - ### ByteSequencesReader

    public ByteSequencesReader(ChecksumIndexInput in, String name)
    Constructs a ByteSequencesReader from the provided IndexInput

- ## Method Details

  - ### next

    public BytesRef next() throws IOException
    Reads the next entry into the provided `BytesRef`. The internal storage is resized if needed.
    Specified by:
      `next` in interface `BytesRefIterator`
    Returns:
      Returns `false` if EOF occurred when trying to read the header of the next sequence. Returns `true` otherwise.
    Throws:
      `EOFException` - if the file ends before the full sequence is read.
      `IOException` - If there is a low-level I/O error.

  - ### close

    public void close() throws IOException
    Closes the provided `IndexInput`.
    Specified by:
      `close` in interface `AutoCloseable`
    Specified by:
      `close` in interface `Closeable`
    Throws:
      `IOException`