|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.lucene.codecs.StoredFieldsWriter
public abstract class StoredFieldsWriter
Codec API for writing stored fields:
startDocument(int)
is called,
informing the Codec how many fields will be written.
writeField(FieldInfo, IndexableField)
is called for
each field in the document.
finish(FieldInfos, int)
is called for verification/sanity-checks.
close()
)
Constructor Summary | |
---|---|
protected |
StoredFieldsWriter()
Sole constructor. |
Method Summary | |
---|---|
abstract void |
abort()
Aborts writing entirely, implementation should remove any partially-written files, etc. |
protected void |
addDocument(Iterable<? extends IndexableField> doc,
FieldInfos fieldInfos)
sugar method for startDocument() + writeField() for every stored field in the document |
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(int numStoredFields)
Called before writing the stored fields of the document. |
abstract void |
writeField(FieldInfo info,
IndexableField field)
Writes a single stored field. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected StoredFieldsWriter()
Method Detail |
---|
public abstract void startDocument(int numStoredFields) throws IOException
writeField(FieldInfo, IndexableField)
will be called
numStoredFields
times. Note that this is
called even if the document has no stored fields, in
this case numStoredFields
will be zero.
IOException
public void finishDocument() throws IOException
IOException
public abstract void writeField(FieldInfo info, IndexableField field) throws IOException
IOException
public abstract void abort()
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(int)
, 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(int)
,
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
protected final void addDocument(Iterable<? extends IndexableField> doc, FieldInfos fieldInfos) throws IOException
IOException
public abstract void close() throws IOException
close
in interface Closeable
IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |