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>
ARecordReader
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 producesStringRecord
s.- Author:
- Mahmoud Ben Hassine ([email protected])
-
-
Constructor Summary
Constructors Constructor Description StandardInputRecordReader()
Create a newStandardInputRecordReader
with default termination word equal to 'quit'.StandardInputRecordReader(java.lang.String terminationWord)
Create a newStandardInputRecordReader
instance with a termination word.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close the reader.void
open()
Open the reader.StringRecord
readRecord()
Read next record from the data source.
-
-
-
Constructor Detail
-
StandardInputRecordReader
public StandardInputRecordReader()
Create a newStandardInputRecordReader
with default termination word equal to 'quit'.
-
StandardInputRecordReader
public StandardInputRecordReader(java.lang.String terminationWord)
Create a newStandardInputRecordReader
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 interfaceRecordReader<java.lang.String>
-
readRecord
public StringRecord readRecord()
Description copied from interface:RecordReader
Read next record from the data source.- Specified by:
readRecord
in interfaceRecordReader<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 interfaceRecordReader<java.lang.String>
-
-