Package org.apache.lucene.util.bkd
Class OfflinePointWriter
- java.lang.Object
-
- org.apache.lucene.util.bkd.OfflinePointWriter
-
- All Implemented Interfaces:
Closeable,AutoCloseable,PointWriter
public final class OfflinePointWriter extends Object implements PointWriter
Writes points to disk in a fixed-with format.- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
-
Field Summary
Fields Modifier and Type Field Description StringnameIndexOutputout
-
Constructor Summary
Constructors Constructor Description OfflinePointWriter(Directory tempDir, String tempFileNamePrefix, int packedBytesLength, boolean longOrds, String desc, long expectedCount, boolean singleValuePerDoc)Create a new writer with an unknown number of incoming pointsOfflinePointWriter(Directory tempDir, String name, int packedBytesLength, long count, boolean longOrds, boolean singleValuePerDoc)Initializes on an already written/closed file, just so consumers can usegetReader(long, long)to read the file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappend(byte[] packedValue, long ord, int docID)Add a new pointvoidclose()voiddestroy()Removes any temp files behind this writerPointReadergetReader(long start, long length)Returns aPointReaderiterator to step through all previously added pointsPointReadergetSharedReader(long start, long length, List<Closeable> toCloseHeroically)Returns the single shared reader, used at multiple times during the recursion, to read previously added pointsStringtoString()
-
-
-
Field Detail
-
out
public final IndexOutput out
-
name
public final String name
-
-
Constructor Detail
-
OfflinePointWriter
public OfflinePointWriter(Directory tempDir, String tempFileNamePrefix, int packedBytesLength, boolean longOrds, String desc, long expectedCount, boolean singleValuePerDoc) throws IOException
Create a new writer with an unknown number of incoming points- Throws:
IOException
-
OfflinePointWriter
public OfflinePointWriter(Directory tempDir, String name, int packedBytesLength, long count, boolean longOrds, boolean singleValuePerDoc)
Initializes on an already written/closed file, just so consumers can usegetReader(long, long)to read the file.
-
-
Method Detail
-
append
public void append(byte[] packedValue, long ord, int docID) throws IOExceptionDescription copied from interface:PointWriterAdd a new point- Specified by:
appendin interfacePointWriter- Throws:
IOException
-
getReader
public PointReader getReader(long start, long length) throws IOException
Description copied from interface:PointWriterReturns aPointReaderiterator to step through all previously added points- Specified by:
getReaderin interfacePointWriter- Throws:
IOException
-
getSharedReader
public PointReader getSharedReader(long start, long length, List<Closeable> toCloseHeroically) throws IOException
Description copied from interface:PointWriterReturns the single shared reader, used at multiple times during the recursion, to read previously added points- Specified by:
getSharedReaderin interfacePointWriter- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
destroy
public void destroy() throws IOExceptionDescription copied from interface:PointWriterRemoves any temp files behind this writer- Specified by:
destroyin interfacePointWriter- Throws:
IOException
-
-