Package org.apache.batchee.extras.buffered

## Class BufferedItemReader<R>

- java.lang.Object
- - org.apache.batchee.extras.typed.TypedItemReader<R,​Serializable>
  - - org.apache.batchee.extras.typed.NoStateTypedItemReader<R>
    - - org.apache.batchee.extras.buffered.BufferedItemReader<R>

- Type Parameters:
    `R` - the return type of the reader
  All Implemented Interfaces:
    `javax.batch.api.chunk.ItemReader`

      public abstract class BufferedItemReader<R>
      extends NoStateTypedItemReader<R>

  An ItemReader base class which provides a simple buffering mechanism. The intention is to have a single simple query in `readAllItems()` which first reads all the items and have this class handle the rest. This simple Reader doesn't provide any checkpointInfo (`ItemReader.checkpointInfo()`) as we only read the items in one go.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `BufferedItemReader()` |

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected R` | `doRead()` |
    `protected abstract Iterator<R>` | `readAllItems()` | This methods need to return all the items to be read.

    - ### Methods inherited from class org.apache.batchee.extras.typed.NoStateTypedItemReader

      `close, doCheckpointInfo, doOpen`

    - ### Methods inherited from class org.apache.batchee.extras.typed.TypedItemReader

      `checkpointInfo, open, readItem`

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

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

- - ### Constructor Detail

    - #### BufferedItemReader

          public BufferedItemReader()

  - ### Method Detail

    - #### readAllItems

          protected abstract Iterator<R> readAllItems()

      This methods need to return all the items to be read. We will 'cache' them and iterate through them until all the items got consumed.
      Returns:
        all the items to be read

    - #### doRead

          protected R doRead()

      Specified by:
        `doRead` in class `TypedItemReader<R,​Serializable>`