org.apache.lucene.codecs.simpletext
Class SimpleTextStoredFieldsWriter

java.lang.Object
  extended by org.apache.lucene.codecs.StoredFieldsWriter
      extended by org.apache.lucene.codecs.simpletext.SimpleTextStoredFieldsWriter
All Implemented Interfaces:
Closeable

public class SimpleTextStoredFieldsWriter
extends StoredFieldsWriter

Writes plain-text stored fields.

FOR RECREATIONAL USE ONLY

WARNING: This API is experimental and might change in incompatible ways in the next release.

Constructor Summary
SimpleTextStoredFieldsWriter(Directory directory, String segment, IOContext context)
           
 
Method Summary
 void abort()
          Aborts writing entirely, implementation should remove any partially-written files, etc.
 void close()
           
 void finish(FieldInfos fis, int numDocs)
          Called before Closeable.close(), passing in the number of documents that were written.
 void startDocument(int numStoredFields)
          Called before writing the stored fields of the document.
 void writeField(FieldInfo info, IndexableField field)
          Writes a single stored field.
 
Methods inherited from class org.apache.lucene.codecs.StoredFieldsWriter
addDocument, merge
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleTextStoredFieldsWriter

public SimpleTextStoredFieldsWriter(Directory directory,
                                    String segment,
                                    IOContext context)
                             throws IOException
Throws:
IOException
Method Detail

startDocument

public void startDocument(int numStoredFields)
                   throws IOException
Description copied from class: StoredFieldsWriter
Called before writing the stored fields of the document. StoredFieldsWriter.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.

Specified by:
startDocument in class StoredFieldsWriter
Throws:
IOException

writeField

public void writeField(FieldInfo info,
                       IndexableField field)
                throws IOException
Description copied from class: StoredFieldsWriter
Writes a single stored field.

Specified by:
writeField in class StoredFieldsWriter
Throws:
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 class StoredFieldsWriter

finish

public void finish(FieldInfos fis,
                   int numDocs)
            throws IOException
Description copied from class: StoredFieldsWriter
Called before Closeable.close(), passing in the number of documents that were written. Note that this is intentionally redundant (equivalent to the number of calls to StoredFieldsWriter.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 class StoredFieldsWriter
Throws:
IOException

close

public void close()
           throws IOException
Throws:
IOException


Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.