Package org.apache.lucene.search.suggest
Class Sort.ByteSequencesWriter
- java.lang.Object
-
- org.apache.lucene.search.suggest.Sort.ByteSequencesWriter
-
- All Implemented Interfaces:
Closeable,AutoCloseable
- Enclosing class:
- Sort
public static class Sort.ByteSequencesWriter extends Object implements Closeable
Utility class to emit length-prefixed byte[] entries to an output stream for sorting. Complementary toSort.ByteSequencesReader.
-
-
Constructor Summary
Constructors Constructor Description ByteSequencesWriter(DataOutput os)Constructs a ByteSequencesWriter to the provided DataOutputByteSequencesWriter(File file)Constructs a ByteSequencesWriter to the provided File
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the providedDataOutputif it isCloseable.voidwrite(byte[] bytes)Writes a byte array.voidwrite(byte[] bytes, int off, int len)Writes a byte array.voidwrite(BytesRef ref)Writes a BytesRef.
-
-
-
Constructor Detail
-
ByteSequencesWriter
public ByteSequencesWriter(File file) throws IOException
Constructs a ByteSequencesWriter to the provided File- Throws:
IOException
-
ByteSequencesWriter
public ByteSequencesWriter(DataOutput os)
Constructs a ByteSequencesWriter to the provided DataOutput
-
-
Method Detail
-
write
public void write(BytesRef ref) throws IOException
Writes a BytesRef.- Throws:
IOException- See Also:
write(byte[], int, int)
-
write
public void write(byte[] bytes) throws IOExceptionWrites a byte array.- Throws:
IOException- See Also:
write(byte[], int, int)
-
write
public void write(byte[] bytes, int off, int len) throws IOExceptionWrites a byte array.The length is written as a
short, followed by the bytes.- Throws:
IOException
-
close
public void close() throws IOExceptionCloses the providedDataOutputif it isCloseable.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
-