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 String
name
IndexOutput
out
-
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 void
append(byte[] packedValue, long ord, int docID)
Add a new pointvoid
close()
void
destroy()
Removes any temp files behind this writerPointReader
getReader(long start, long length)
Returns aPointReader
iterator to step through all previously added pointsPointReader
getSharedReader(long start, long length, List<Closeable> toCloseHeroically)
Returns the single shared reader, used at multiple times during the recursion, to read previously added pointsString
toString()
-
-
-
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 IOException
Description copied from interface:PointWriter
Add a new point- Specified by:
append
in interfacePointWriter
- Throws:
IOException
-
getReader
public PointReader getReader(long start, long length) throws IOException
Description copied from interface:PointWriter
Returns aPointReader
iterator to step through all previously added points- Specified by:
getReader
in interfacePointWriter
- Throws:
IOException
-
getSharedReader
public PointReader getSharedReader(long start, long length, List<Closeable> toCloseHeroically) throws IOException
Description copied from interface:PointWriter
Returns the single shared reader, used at multiple times during the recursion, to read previously added points- Specified by:
getSharedReader
in interfacePointWriter
- Throws:
IOException
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
destroy
public void destroy() throws IOException
Description copied from interface:PointWriter
Removes any temp files behind this writer- Specified by:
destroy
in interfacePointWriter
- Throws:
IOException
-
-