Class StoredFieldsWriter

    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract void abort()
      Aborts writing entirely, implementation should remove any partially-written files, etc.
      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

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • startDocument

        public abstract void startDocument​(int numStoredFields)
                                    throws java.io.IOException
        Called before writing the stored fields of the document. 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.
        Throws:
        java.io.IOException
      • finishDocument

        public void finishDocument()
                            throws java.io.IOException
        Called when a document and all its fields have been added.
        Throws:
        java.io.IOException
      • writeField

        public abstract void writeField​(FieldInfo info,
                                        IndexableField field)
                                 throws java.io.IOException
        Writes a single stored field.
        Throws:
        java.io.IOException
      • abort

        public abstract void abort()
        Aborts writing entirely, implementation should remove any partially-written files, etc.
      • finish

        public abstract void finish​(FieldInfos fis,
                                    int numDocs)
                             throws java.io.IOException
        Called before 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.
        Throws:
        java.io.IOException
      • merge

        public int merge​(MergeState mergeState)
                  throws java.io.IOException
        Merges in the stored fields from the readers in 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).
        Throws:
        java.io.IOException
      • close

        public abstract void close()
                            throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException