Package org.refcodes.tabular
Interface RecordsReader<T>
-
- Type Parameters:
T
- The type managed by theRecords
.
- All Superinterfaces:
java.lang.AutoCloseable
,HeaderAccessor<T>
,java.lang.Iterable<T>
,java.util.Iterator<T>
,Records<T>
- All Known Implementing Classes:
CsvRecordsReader
,CsvStringRecordsReader
public interface RecordsReader<T> extends java.lang.AutoCloseable, Records<T>, HeaderAccessor<T>
Extends theRecords
with functionality for file based implementations regarding header management and means to monitor the state of reading data. ReadingRecord
instances may cause problems but no abortion of an operation (if desired), the statistics of the problems may be reported by an implementation of this interface.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.refcodes.tabular.HeaderAccessor
HeaderAccessor.HeaderBuilder<T extends HeaderAccessor.HeaderBuilder<?>>, HeaderAccessor.HeaderMutator<T>, HeaderAccessor.HeaderProperty<T>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description long
getErroneousRecordCount()
The number of erroneous records which were not read by theRecordsReader
.Header<T>
readHeader()
Creates aHeader
from the next line to be read .java.lang.String[]
readNext()
Reads the next line from the (standard) input (stream or file) and returns an array of itsString
representation.java.lang.String
skipHeader()
Skips the next line to be read.-
Methods inherited from interface org.refcodes.tabular.HeaderAccessor
getHeader
-
-
-
-
Method Detail
-
getErroneousRecordCount
long getErroneousRecordCount()
The number of erroneous records which were not read by theRecordsReader
.- Returns:
- the erroneous record count
-
readHeader
Header<T> readHeader() throws java.io.IOException
Creates aHeader
from the next line to be read .- Returns:
- Returns the
Header
being read. - Throws:
java.io.IOException
- thrown in case reading from IO failed.
-
skipHeader
java.lang.String skipHeader() throws java.io.IOException
Skips the next line to be read. This line will not be processed by theIterator.next()
method. This methods is useful when skipping the first line (header).- Returns:
- The line being skipped.
- Throws:
java.io.IOException
- thrown in case if IO problems.
-
readNext
java.lang.String[] readNext()
Reads the next line from the (standard) input (stream or file) and returns an array of itsString
representation.- Returns:
- The
String
array representation of the nextRecord
instance read.
-
-