public abstract class StoredFieldsWriter extends Object implements Closeable
startDocument()
is called,
informing the Codec that a new document has started.
writeField(FieldInfo, IndexableField)
is called for
each field in the document.
finish(FieldInfos, int)
is called for verification/sanity-checks.
close()
)
Modifier and Type | Class and Description |
---|---|
protected class |
StoredFieldsWriter.MergeVisitor
A visitor that adds every field it sees.
|
Modifier | Constructor and Description |
---|---|
protected |
StoredFieldsWriter()
Sole constructor.
|
Modifier and Type | Method and Description |
---|---|
abstract void |
close() |
abstract void |
finish(FieldInfos fis,
int numDocs)
Called before
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 in
mergeState . |
abstract void |
startDocument()
Called before writing the stored fields of the document.
|
abstract void |
writeField(FieldInfo info,
IndexableField field)
Writes a single stored field.
|
protected StoredFieldsWriter()
public abstract void startDocument() throws IOException
writeField(FieldInfo, IndexableField)
will be called
for each stored field. Note that this is
called even if the document has no stored fields.IOException
public void finishDocument() throws IOException
IOException
public abstract void writeField(FieldInfo info, IndexableField field) throws IOException
IOException
public abstract void finish(FieldInfos fis, int numDocs) throws IOException
close()
, passing in the number
of documents that were written. Note that this is
intentionally redundant (equivalent to the number of
calls to startDocument()
, but a Codec should
check that this is the case to detect the JRE bug described
in LUCENE-1282.IOException
public int merge(MergeState mergeState) throws IOException
mergeState
. The default implementation skips
over deleted documents, and uses startDocument()
,
writeField(FieldInfo, IndexableField)
, and finish(FieldInfos, int)
,
returning the number of documents that were written.
Implementations can override this method for more sophisticated
merging (bulk-byte copying, etc).IOException
public abstract void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.