Package org.apache.lucene.search.suggest
Class Sort.ByteSequencesWriter
- java.lang.Object
-
- org.apache.lucene.search.suggest.Sort.ByteSequencesWriter
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
- Enclosing class:
- Sort
public static class Sort.ByteSequencesWriter extends java.lang.Object implements java.io.CloseableUtility class to emit length-prefixed byte[] entries to an output stream for sorting. Complementary toSort.ByteSequencesReader.
-
-
Constructor Summary
Constructors Constructor Description ByteSequencesWriter(java.io.DataOutput os)Constructs a ByteSequencesWriter to the provided DataOutputByteSequencesWriter(java.io.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(java.io.File file) throws java.io.IOExceptionConstructs a ByteSequencesWriter to the provided File- Throws:
java.io.IOException
-
ByteSequencesWriter
public ByteSequencesWriter(java.io.DataOutput os)
Constructs a ByteSequencesWriter to the provided DataOutput
-
-
Method Detail
-
write
public void write(BytesRef ref) throws java.io.IOException
Writes a BytesRef.- Throws:
java.io.IOException- See Also:
write(byte[], int, int)
-
write
public void write(byte[] bytes) throws java.io.IOExceptionWrites a byte array.- Throws:
java.io.IOException- See Also:
write(byte[], int, int)
-
write
public void write(byte[] bytes, int off, int len) throws java.io.IOExceptionWrites a byte array.The length is written as a
short, followed by the bytes.- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOExceptionCloses the providedDataOutputif it isCloseable.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
-