## org.apache.lucene.util
Class ReaderUtil

    java.lang.Object
      org.apache.lucene.util.ReaderUtil

    public class ReaderUtil

extends java.lang.Object

Common util methods for dealing with `IndexReader`s.

Constructor Summary
`ReaderUtil()`

Method Summary
`static void` `gatherSubReaders(java.util.List allSubReaders, IndexReader reader)` Gathers sub-readers from reader into a List.
`static int` `subIndex(int n, int[] docStarts)` Returns index of the searcher/reader for document `n` in the array used to construct this searcher/reader.
`static IndexReader` `subReader(IndexReader reader, int subIndex)` Returns sub-reader subIndex from reader.
`static IndexReader` `subReader(int doc, IndexReader reader)` Returns sub IndexReader that contains the given document id.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ReaderUtil

    public ReaderUtil()

Method Detail

### gatherSubReaders

    public static void gatherSubReaders(java.util.List allSubReaders,
                                        IndexReader reader)

  Gathers sub-readers from reader into a List.

  Parameters:
    `allSubReaders` -
    `reader` -

### subReader

    public static IndexReader subReader(int doc,
                                        IndexReader reader)

  Returns sub IndexReader that contains the given document id.

  Parameters:
    `doc` - id of document
    `reader` - parent reader
  Returns:
    sub reader of parent which contains the specified doc id

### subReader

    public static IndexReader subReader(IndexReader reader,
                                        int subIndex)

  Returns sub-reader subIndex from reader.

  Parameters:
    `reader` - parent reader
    `subIndex` - index of desired sub reader
  Returns:
    the subreader at subIndex

### subIndex

    public static int subIndex(int n,
                               int[] docStarts)

  Returns index of the searcher/reader for document `n` in the array used to construct this searcher/reader.

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