Package org.jeasy.batch.core.reader
Class FileRecordReader
- java.lang.Object
-
- org.jeasy.batch.core.reader.FileRecordReader
-
- All Implemented Interfaces:
RecordReader<java.nio.file.Path>
public class FileRecordReader extends java.lang.Object implements RecordReader<java.nio.file.Path>
ARecordReaderthat reads files in a directory. This reader producesFileRecordinstances.- Author:
- Mahmoud Ben Hassine (mahmoud.benhassine@icloud.com)
-
-
Constructor Summary
Constructors Constructor Description FileRecordReader(java.nio.file.Path path)Create a newFileRecordReader.FileRecordReader(java.nio.file.Path path, boolean recursive)Create a newFileRecordReader.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close the reader.voidopen()Open the reader.FileRecordreadRecord()Read next record from the data source.
-
-
-
Constructor Detail
-
FileRecordReader
public FileRecordReader(java.nio.file.Path path)
Create a newFileRecordReader.- Parameters:
path- to read files from
-
FileRecordReader
public FileRecordReader(java.nio.file.Path path, boolean recursive)Create a newFileRecordReader.- Parameters:
path- to read files fromrecursive- if the reader should be recursive or not
-
-
Method Detail
-
open
public void open() throws java.lang.ExceptionDescription copied from interface:RecordReaderOpen the reader.- Specified by:
openin interfaceRecordReader<java.nio.file.Path>- Throws:
java.lang.Exception- if an error occurs during reader opening
-
close
public void close() throws java.lang.ExceptionDescription copied from interface:RecordReaderClose the reader.- Specified by:
closein interfaceRecordReader<java.nio.file.Path>- Throws:
java.lang.Exception- if an error occurs during reader closing
-
readRecord
public FileRecord readRecord()
Description copied from interface:RecordReaderRead next record from the data source.- Specified by:
readRecordin interfaceRecordReader<java.nio.file.Path>- Returns:
- the next record from the data source or
nullif the end of the data source is reached
-
-