Class StreamRecordReader<T>

  • Type Parameters:
    T - Type of elements in the stream.
    All Implemented Interfaces:
    RecordReader<T>

    public class StreamRecordReader<T>
    extends java.lang.Object
    implements RecordReader<T>
    Reader that reads records form a Stream. This reader produces GenericRecord instances.
    Since:
    5.0
    Author:
    Charles Fleury
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Close the reader.
      void open()
      Open the reader.
      Record<T> readRecord()
      Read next record from the data source.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • dataSource

        protected java.util.stream.Stream<T> dataSource
      • iterator

        protected java.util.Iterator<T> iterator
      • currentRecordNumber

        protected long currentRecordNumber
    • Constructor Detail

      • StreamRecordReader

        public StreamRecordReader​(java.util.stream.Stream<T> dataSource)
        Create a new StreamRecordReader to read records from a Stream.
        Parameters:
        dataSource - to read records from
    • Method Detail

      • readRecord

        public Record<T> readRecord()
        Description copied from interface: RecordReader
        Read next record from the data source.
        Specified by:
        readRecord in interface RecordReader<T>
        Returns:
        the next record from the data source or null if the end of the data source is reached