Class MemoryReader


public class MemoryReader extends DataReader
Obtains records from an in-memory RecordList.
  • Constructor Details

    • MemoryReader

      public MemoryReader(RecordList recordSet)
      Creates a reader that returns copies of the records in the given list, starting over each time it is opened.
    • MemoryReader

      public MemoryReader()
      Creates a reader over a new, empty list; add records with add(Record).
  • Method Details

    • add

      public MemoryReader add(Record record)
      Appends the record to the underlying list, which is the caller's list when one was passed to the constructor.
    • getRecordList

      public RecordList getRecordList()
    • open

      public void open()
      Description copied from class: DataEndpoint
      Makes this endpoint ready for reading or writing.
      Overrides:
      open in class DataEndpoint
    • readImpl

      protected Record readImpl() throws Throwable
      Description copied from class: DataReader
      Overridden by subclasses to read the next record from this DataReader. The default implementation of DataReader.read() now insures that this method will not be called again after it returns a null.

      If no record is available, null will be returned.

      Contract for subclasses (see also docs/authoring/DataReader.md):

      Specified by:
      readImpl in class DataReader
      Throws:
      Throwable
    • available

      public int available()
      Description copied from class: DataReader
      Returns the number of records that can probably be read without blocking.
      Overrides:
      available in class DataReader