public class StandardInputRecordReader extends Object implements RecordReader
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).
Note: This reader produces StringRecord instances. when the termination word is read, the reader
returns a PoisonRecord, so you need to filter the last record with a PoisonRecordFilter
when using this reader.
| Constructor and Description |
|---|
StandardInputRecordReader()
Create a
StandardInputRecordReader with default termination input equal to 'quit'. |
StandardInputRecordReader(String terminationInput)
Create a
StandardInputRecordReader instance with a termination word. |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the reader.
|
String |
getDataSourceName()
This method returns a human readable data source name to be shown in the batch report.
|
Long |
getTotalRecords()
Get the total record number in the data source.
|
boolean |
hasNextRecord()
Check if the reader has a next record.
|
void |
open()
Open the reader.
|
Record |
readNextRecord()
Read next record from the data source.
|
public StandardInputRecordReader()
StandardInputRecordReader with default termination input equal to 'quit'.public StandardInputRecordReader(String terminationInput)
StandardInputRecordReader instance with a termination word.terminationInput - the word to type to stop reading from the standard input.public void open()
RecordReaderopen in interface RecordReaderpublic boolean hasNextRecord()
RecordReaderhasNextRecord in interface RecordReaderpublic Record readNextRecord()
RecordReaderreadNextRecord in interface RecordReaderpublic Long getTotalRecords()
RecordReadergetTotalRecords in interface RecordReaderpublic String getDataSourceName()
RecordReadergetDataSourceName in interface RecordReaderpublic void close()
RecordReaderclose in interface RecordReaderCopyright © 2015. All Rights Reserved.