Class Sort.ByteSequencesReader
- java.lang.Object
-
- org.apache.lucene.search.suggest.fst.Sort.ByteSequencesReader
-
- All Implemented Interfaces:
Closeable,AutoCloseable
- Enclosing class:
- Sort
public static class Sort.ByteSequencesReader extends Object implements Closeable
Utility class to read length-prefixed byte[] entries from an input. Complementary toSort.ByteSequencesWriter.
-
-
Constructor Summary
Constructors Constructor Description ByteSequencesReader(DataInput is)ByteSequencesReader(File file)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()byte[]read()Reads the next entry and returns it if successful.booleanread(org.apache.lucene.util.BytesRef ref)Reads the next entry into the providedBytesRef.
-
-
-
Constructor Detail
-
ByteSequencesReader
public ByteSequencesReader(File file) throws IOException
- Throws:
IOException
-
ByteSequencesReader
public ByteSequencesReader(DataInput is)
-
-
Method Detail
-
read
public boolean read(org.apache.lucene.util.BytesRef ref) throws IOExceptionReads the next entry into the providedBytesRef. The internal storage is resized if needed.- Returns:
- Returns
falseif EOF occurred when trying to read the header of the next sequence. Returnstrueotherwise. - Throws:
EOFException- if the file ends before the full sequence is read.IOException
-
read
public byte[] read() throws IOExceptionReads the next entry and returns it if successful.- Returns:
- Returns
nullif 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- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
-