Class StandardInputRecordReader

  • All Implemented Interfaces:
    RecordReader<java.lang.String>

    public class StandardInputRecordReader
    extends java.lang.Object
    implements RecordReader<java.lang.String>
    A RecordReader that reads data from the standard input (useful for tests) until a termination word is read (can be specified at construction time, "quit" by default). This reader produces StringRecords.
    Author:
    Mahmoud Ben Hassine ([email protected])
    • Constructor Detail

      • StandardInputRecordReader

        public StandardInputRecordReader()
        Create a new StandardInputRecordReader with default termination word equal to 'quit'.
      • StandardInputRecordReader

        public StandardInputRecordReader​(java.lang.String terminationWord)
        Create a new StandardInputRecordReader instance with a termination word.
        Parameters:
        terminationWord - the word to type to stop reading from the standard input.
    • Method Detail

      • open

        public void open()
        Description copied from interface: RecordReader
        Open the reader.
        Specified by:
        open in interface RecordReader<java.lang.String>
      • readRecord

        public StringRecord readRecord()
        Description copied from interface: RecordReader
        Read next record from the data source.
        Specified by:
        readRecord in interface RecordReader<java.lang.String>
        Returns:
        the next record from the data source or null if the end of the data source is reached
      • close

        public void close()
        Description copied from interface: RecordReader
        Close the reader.
        Specified by:
        close in interface RecordReader<java.lang.String>