Package org.jeasy.batch.core.reader
Class StandardInputRecordReader
- java.lang.Object
-
- org.jeasy.batch.core.reader.StandardInputRecordReader
-
- All Implemented Interfaces:
RecordReader<java.lang.String>
public class StandardInputRecordReader extends java.lang.Object implements RecordReader<java.lang.String>
ARecordReaderthat 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 producesStringRecords.- Author:
- Mahmoud Ben Hassine (mahmoud.benhassine@icloud.com)
-
-
Constructor Summary
Constructors Constructor Description StandardInputRecordReader()Create a newStandardInputRecordReaderwith default termination word equal to 'quit'.StandardInputRecordReader(java.lang.String terminationWord)Create a newStandardInputRecordReaderinstance with a termination word.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close the reader.voidopen()Open the reader.StringRecordreadRecord()Read next record from the data source.
-
-
-
Constructor Detail
-
StandardInputRecordReader
public StandardInputRecordReader()
Create a newStandardInputRecordReaderwith default termination word equal to 'quit'.
-
StandardInputRecordReader
public StandardInputRecordReader(java.lang.String terminationWord)
Create a newStandardInputRecordReaderinstance 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:RecordReaderOpen the reader.- Specified by:
openin interfaceRecordReader<java.lang.String>
-
readRecord
public StringRecord readRecord()
Description copied from interface:RecordReaderRead next record from the data source.- Specified by:
readRecordin interfaceRecordReader<java.lang.String>- Returns:
- the next record from the data source or
nullif the end of the data source is reached
-
close
public void close()
Description copied from interface:RecordReaderClose the reader.- Specified by:
closein interfaceRecordReader<java.lang.String>
-
-