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 and Description
    --- | ---
    `protected long` | `end`
    `protected ChecksumIndexInput` | `in`
    `protected String` | `name`

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

      `EMPTY`

  - ### Constructor Summary

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and 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 Detail

    - #### name

          protected final String name

    - #### in

          protected final ChecksumIndexInput in

    - #### end

          protected final long end

  - ### Constructor Detail

    - #### ByteSequencesReader

          public ByteSequencesReader(ChecksumIndexInput in,
                                     String name)

      Constructs a ByteSequencesReader from the provided IndexInput

  - ### Method Detail

    - #### 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 `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`
      Throws:
        `IOException`

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