Class Lucene40StoredFieldsWriter
- java.lang.Object
 - 
- org.apache.lucene.codecs.StoredFieldsWriter
 - 
- org.apache.lucene.codecs.lucene40.Lucene40StoredFieldsWriter
 
 
 
- 
- All Implemented Interfaces:
 java.io.Closeable,java.lang.AutoCloseable
public final class Lucene40StoredFieldsWriter extends StoredFieldsWriter
Class responsible for writing stored document fields. It uses <segment>.fdt and <segment>.fdx; files.- See Also:
 Lucene40StoredFieldsFormat
 
- 
- 
Field Summary
Fields Modifier and Type Field Description static java.lang.StringFIELDS_EXTENSIONExtension of stored fields filestatic java.lang.StringFIELDS_INDEX_EXTENSIONExtension of stored fields index file 
- 
Constructor Summary
Constructors Constructor Description Lucene40StoredFieldsWriter(Directory directory, java.lang.String segment, IOContext context)Sole constructor. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabort()Aborts writing entirely, implementation should remove any partially-written files, etc.voidaddRawDocuments(IndexInput stream, int[] lengths, int numDocs)Bulk write a contiguous series of documents.voidclose()voidfinish(FieldInfos fis, int numDocs)Called beforeStoredFieldsWriter.close(), passing in the number of documents that were written.intmerge(MergeState mergeState)Merges in the stored fields from the readers inmergeState.voidstartDocument(int numStoredFields)Called before writing the stored fields of the document.voidwriteField(FieldInfo info, IndexableField field)Writes a single stored field.- 
Methods inherited from class org.apache.lucene.codecs.StoredFieldsWriter
finishDocument 
 - 
 
 - 
 
- 
- 
Field Detail
- 
FIELDS_EXTENSION
public static final java.lang.String FIELDS_EXTENSION
Extension of stored fields file- See Also:
 - Constant Field Values
 
 
- 
FIELDS_INDEX_EXTENSION
public static final java.lang.String FIELDS_INDEX_EXTENSION
Extension of stored fields index file- See Also:
 - Constant Field Values
 
 
 - 
 
- 
Method Detail
- 
startDocument
public void startDocument(int numStoredFields) throws java.io.IOExceptionDescription copied from class:StoredFieldsWriterCalled before writing the stored fields of the document.StoredFieldsWriter.writeField(FieldInfo, IndexableField)will be callednumStoredFieldstimes. Note that this is called even if the document has no stored fields, in this casenumStoredFieldswill be zero.- Specified by:
 startDocumentin classStoredFieldsWriter- Throws:
 java.io.IOException
 
- 
close
public void close() throws java.io.IOException- Specified by:
 closein interfacejava.lang.AutoCloseable- Specified by:
 closein interfacejava.io.Closeable- Specified by:
 closein classStoredFieldsWriter- Throws:
 java.io.IOException
 
- 
abort
public void abort()
Description copied from class:StoredFieldsWriterAborts writing entirely, implementation should remove any partially-written files, etc.- Specified by:
 abortin classStoredFieldsWriter
 
- 
writeField
public void writeField(FieldInfo info, IndexableField field) throws java.io.IOException
Description copied from class:StoredFieldsWriterWrites a single stored field.- Specified by:
 writeFieldin classStoredFieldsWriter- Throws:
 java.io.IOException
 
- 
addRawDocuments
public void addRawDocuments(IndexInput stream, int[] lengths, int numDocs) throws java.io.IOException
Bulk write a contiguous series of documents. The lengths array is the length (in bytes) of each raw document. The stream IndexInput is the fieldsStream from which we should bulk-copy all bytes.- Throws:
 java.io.IOException
 
- 
finish
public void finish(FieldInfos fis, int numDocs)
Description copied from class:StoredFieldsWriterCalled 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:
 finishin classStoredFieldsWriter
 
- 
merge
public int merge(MergeState mergeState) throws java.io.IOException
Description copied from class:StoredFieldsWriterMerges 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:
 mergein classStoredFieldsWriter- Throws:
 java.io.IOException
 
 - 
 
 -