Class CompressingStoredFieldsWriter
- java.lang.Object
-
- org.apache.lucene.codecs.StoredFieldsWriter
-
- org.apache.lucene.codecs.compressing.CompressingStoredFieldsWriter
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public final class CompressingStoredFieldsWriter extends StoredFieldsWriter
-
-
Constructor Summary
Constructors Constructor Description CompressingStoredFieldsWriter(Directory directory, SegmentInfo si, java.lang.String segmentSuffix, IOContext context, java.lang.String formatName, CompressionMode compressionMode, int chunkSize)
Sole constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
abort()
Aborts writing entirely, implementation should remove any partially-written files, etc.void
close()
void
finish(FieldInfos fis, int numDocs)
Called beforeStoredFieldsWriter.close()
, passing in the number of documents that were written.void
finishDocument()
Called when a document and all its fields have been added.int
merge(MergeState mergeState)
Merges in the stored fields from the readers inmergeState
.void
startDocument(int numStoredFields)
Called before writing the stored fields of the document.void
writeField(FieldInfo info, IndexableField field)
Writes a single stored field.
-
-
-
Constructor Detail
-
CompressingStoredFieldsWriter
public CompressingStoredFieldsWriter(Directory directory, SegmentInfo si, java.lang.String segmentSuffix, IOContext context, java.lang.String formatName, CompressionMode compressionMode, int chunkSize) throws java.io.IOException
Sole constructor.- Throws:
java.io.IOException
-
-
Method Detail
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in classStoredFieldsWriter
- Throws:
java.io.IOException
-
startDocument
public void startDocument(int numStoredFields) throws java.io.IOException
Description copied from class:StoredFieldsWriter
Called before writing the stored fields of the document.StoredFieldsWriter.writeField(FieldInfo, IndexableField)
will be callednumStoredFields
times. Note that this is called even if the document has no stored fields, in this casenumStoredFields
will be zero.- Specified by:
startDocument
in classStoredFieldsWriter
- Throws:
java.io.IOException
-
finishDocument
public void finishDocument() throws java.io.IOException
Description copied from class:StoredFieldsWriter
Called when a document and all its fields have been added.- Overrides:
finishDocument
in classStoredFieldsWriter
- Throws:
java.io.IOException
-
writeField
public void writeField(FieldInfo info, IndexableField field) throws java.io.IOException
Description copied from class:StoredFieldsWriter
Writes a single stored field.- Specified by:
writeField
in classStoredFieldsWriter
- Throws:
java.io.IOException
-
abort
public void abort()
Description copied from class:StoredFieldsWriter
Aborts writing entirely, implementation should remove any partially-written files, etc.- Specified by:
abort
in classStoredFieldsWriter
-
finish
public void finish(FieldInfos fis, int numDocs) throws java.io.IOException
Description copied from class:StoredFieldsWriter
Called beforeStoredFieldsWriter.close()
, passing in the number of documents that were written. Note that this is intentionally redundant (equivalent to the number of calls toStoredFieldsWriter.startDocument(int)
, but a Codec should check that this is the case to detect the JRE bug described in LUCENE-1282.- Specified by:
finish
in classStoredFieldsWriter
- Throws:
java.io.IOException
-
merge
public int merge(MergeState mergeState) throws java.io.IOException
Description copied from class:StoredFieldsWriter
Merges in the stored fields from the readers inmergeState
. The default implementation skips over deleted documents, and usesStoredFieldsWriter.startDocument(int)
,StoredFieldsWriter.writeField(FieldInfo, IndexableField)
, andStoredFieldsWriter.finish(FieldInfos, int)
, returning the number of documents that were written. Implementations can override this method for more sophisticated merging (bulk-byte copying, etc).- Overrides:
merge
in classStoredFieldsWriter
- Throws:
java.io.IOException
-
-