## org.apache.lucene.search.suggest
Class Sort.ByteSequencesReader

    java.lang.Object
      org.apache.lucene.search.suggest.Sort.ByteSequencesReader

All Implemented Interfaces:
  Closeable

Enclosing class:
  Sort

    public static class Sort.ByteSequencesReader

extends Object
implements Closeable

Utility class to read length-prefixed byte[] entries from an input. Complementary to `Sort.ByteSequencesWriter`.

Constructor Summary
`Sort.ByteSequencesReader(DataInput is)` Constructs a ByteSequencesReader from the provided DataInput
`Sort.ByteSequencesReader(File file)` Constructs a ByteSequencesReader from the provided File

Method Summary
`void` `close()` Closes the provided `DataInput` if it is `Closeable`.
`byte[]` `read()` Reads the next entry and returns it if successful.
`boolean` `read(BytesRef ref)` 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`

Constructor Detail

### Sort.ByteSequencesReader

    public Sort.ByteSequencesReader(File file)
                             throws IOException

  Constructs a ByteSequencesReader from the provided File

  Throws:
    `IOException`

### Sort.ByteSequencesReader

    public Sort.ByteSequencesReader(DataInput is)

  Constructs a ByteSequencesReader from the provided DataInput

Method Detail

### read

    public boolean read(BytesRef ref)
                 throws IOException

  Reads the next entry into the provided `BytesRef`. The internal storage is resized if needed.

  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`

### read

    public byte[] read()
                throws IOException

  Reads the next entry and returns it if successful.

  Returns:
    Returns `null` if EOF occurred before the next entry could be read.
  Throws:
    `EOFException` - if the file ends before the full sequence is read.
    `IOException`
  See Also:
    `read(BytesRef)`

### close

    public void close()
               throws IOException

  Closes the provided `DataInput` if it is `Closeable`.

  Specified by:
    `close` in interface `Closeable`
  Throws:
    `IOException`

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