org.apache.lucene.codecs

## Class PostingsReaderBase

- java.lang.Object
- - org.apache.lucene.codecs.PostingsReaderBase

All Implemented Interfaces:
  Closeable, AutoCloseable

Direct Known Subclasses:
  Lucene40PostingsReader, Lucene41PostingsReader

    public abstract class PostingsReaderBase
    extends Object
    implements Closeable

The core terms dictionaries (BlockTermsReader, BlockTreeTermsReader) interact with a single instance of this class to manage creation of `DocsEnum` and `DocsAndPositionsEnum` instances. It provides an IndexInput (termsIn) where this class may read any previously stored data that it had written in its corresponding `PostingsWriterBase` at indexing time.

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

### Constructor Summary

Constructors
`protected` `PostingsReaderBase()` Sole constructor.

### Method Summary

Methods
`abstract void` `close()`
`abstract DocsEnum` `docs(FieldInfo fieldInfo, BlockTermState state, Bits skipDocs, DocsEnum reuse, int flags)` Must fully consume state, since after this call that TermState may be reused.
`abstract DocsAndPositionsEnum` `docsAndPositions(FieldInfo fieldInfo, BlockTermState state, Bits skipDocs, DocsAndPositionsEnum reuse, int flags)` Must fully consume state, since after this call that TermState may be reused.
`abstract void` `init(IndexInput termsIn)` Performs any initialization, such as reading and verifying the header from the provided terms dictionary `IndexInput`.
`abstract BlockTermState` `newTermState()` Return a newly created empty TermState
`abstract void` `nextTerm(FieldInfo fieldInfo, BlockTermState state)` Actually decode metadata for next term
`abstract void` `readTermsBlock(IndexInput termsIn, FieldInfo fieldInfo, BlockTermState termState)` Reads data for all terms in the next block; this method should merely load the byte[] blob but not decode, which is done in `nextTerm(org.apache.lucene.index.FieldInfo, org.apache.lucene.codecs.BlockTermState)`.

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

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

### Constructor Detail

#### PostingsReaderBase

    protected PostingsReaderBase()

Sole constructor. (For invocation by subclass constructors, typically implicit.)

### Method Detail

#### init

    public abstract void init(IndexInput termsIn)
                       throws IOException

Performs any initialization, such as reading and verifying the header from the provided terms dictionary `IndexInput`.

Throws:
  `IOException`

#### newTermState

    public abstract BlockTermState newTermState()
                                         throws IOException

Return a newly created empty TermState

Throws:
  `IOException`

#### nextTerm

    public abstract void nextTerm(FieldInfo fieldInfo,
                BlockTermState state)
                           throws IOException

Actually decode metadata for next term

Throws:
  `IOException`

#### docs

    public abstract DocsEnum docs(FieldInfo fieldInfo,
                BlockTermState state,
                Bits skipDocs,
                DocsEnum reuse,
                int flags)
                           throws IOException

Must fully consume state, since after this call that TermState may be reused.

Throws:
  `IOException`

#### docsAndPositions

    public abstract DocsAndPositionsEnum docsAndPositions(FieldInfo fieldInfo,
                                        BlockTermState state,
                                        Bits skipDocs,
                                        DocsAndPositionsEnum reuse,
                                        int flags)
                                                   throws IOException

Must fully consume state, since after this call that TermState may be reused.

Throws:
  `IOException`

#### close

    public abstract void close()
                        throws IOException

Specified by:
  `close` in interface `Closeable`
Specified by:
  `close` in interface `AutoCloseable`
Throws:
  `IOException`

#### readTermsBlock

    public abstract void readTermsBlock(IndexInput termsIn,
                      FieldInfo fieldInfo,
                      BlockTermState termState)
                                 throws IOException

Reads data for all terms in the next block; this method should merely load the byte[] blob but not decode, which is done in `nextTerm(org.apache.lucene.index.FieldInfo, org.apache.lucene.codecs.BlockTermState)`.

Throws:
  `IOException`