org.apache.lucene.codecs.lucene40

## Class Lucene40StoredFieldsReader

- java.lang.Object
- - org.apache.lucene.codecs.StoredFieldsReader
  - - org.apache.lucene.codecs.lucene40.Lucene40StoredFieldsReader

All Implemented Interfaces:
  Closeable, AutoCloseable, Cloneable

    public final class Lucene40StoredFieldsReader
    extends StoredFieldsReader
    implements Cloneable, Closeable

Class responsible for access to stored document fields.

It uses <segment>.fdt and <segment>.fdx; files.

See Also:
  `Lucene40StoredFieldsFormat`
NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

### Constructor Summary

Constructors
Constructor and Description
`Lucene40StoredFieldsReader(Directory d, SegmentInfo si, FieldInfos fn, IOContext context)` Sole constructor.

### Method Summary

Methods
`Lucene40StoredFieldsReader` `clone()` Returns a cloned FieldsReader that shares open IndexInputs with the original one.
`void` `close()` Closes the underlying `IndexInput` streams.
`IndexInput` `rawDocs(int[] lengths, int startDocID, int numDocs)` Returns the length in bytes of each raw document in a contiguous range of length numDocs starting with startDocID.
`int` `size()` Returns number of documents.
`void` `visitDocument(int n, StoredFieldVisitor visitor)` Visit the stored fields for document `n`

### Methods inherited from class java.lang.Object

`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### Lucene40StoredFieldsReader

    public Lucene40StoredFieldsReader(Directory d,
                              SegmentInfo si,
                              FieldInfos fn,
                              IOContext context)
                               throws IOException

Sole constructor.

Throws:
  `IOException`

### Method Detail

#### clone

    public Lucene40StoredFieldsReader clone()

Returns a cloned FieldsReader that shares open IndexInputs with the original one. It is the caller's job not to close the original FieldsReader until all clones are called (eg, currently SegmentReader manages this logic).

Specified by:
  `clone` in class `StoredFieldsReader`

#### close

    public final void close()
                     throws IOException

Closes the underlying `IndexInput` streams. This means that the Fields values will not be accessible.

Specified by:
  `close` in interface `Closeable`
Specified by:
  `close` in interface `AutoCloseable`
Throws:
  `IOException` - If an I/O error occurs

#### size

    public final int size()

Returns number of documents.

#### visitDocument

    public final void visitDocument(int n,
                     StoredFieldVisitor visitor)
                             throws IOException

Description copied from class: `StoredFieldsReader`
Visit the stored fields for document `n`

Specified by:
  `visitDocument` in class `StoredFieldsReader`
Throws:
  `IOException`

#### rawDocs

    public final IndexInput rawDocs(int[] lengths,
                     int startDocID,
                     int numDocs)
                             throws IOException

Returns the length in bytes of each raw document in a contiguous range of length numDocs starting with startDocID. Returns the IndexInput (the fieldStream), already seeked to the starting point for startDocID.

Throws:
  `IOException`