T
- The type managed by the Records
.AutoCloseable
, Iterable<T>
, Iterator<T>
, org.refcodes.io.RowReader<T>
, org.refcodes.mixin.DelimiterAccessor
, org.refcodes.mixin.DelimiterAccessor.DelimiterBuilder<T>
, org.refcodes.mixin.DelimiterAccessor.DelimiterMutator
, org.refcodes.mixin.DelimiterAccessor.DelimiterProperty
, org.refcodes.mixin.TrimAccessor
, org.refcodes.mixin.TrimAccessor.TrimBuilder<T>
, org.refcodes.mixin.TrimAccessor.TrimMutator
, org.refcodes.mixin.TrimAccessor.TrimProperty
, HeaderAccessor<T>
, RecordReader<T>
, Records<T>
, org.refcodes.textual.CsvEscapeModeAccessor
, org.refcodes.textual.CsvEscapeModeAccessor.CsvEscapeModeBuilder<T>
, org.refcodes.textual.CsvEscapeModeAccessor.CsvEscapeModeMutator
, org.refcodes.textual.CsvEscapeModeAccessor.CsvEscapeModeProperty
, org.refcodes.textual.CsvMixin
CsvStringRecordReader
public class CsvRecordReader<T> extends Object implements org.refcodes.textual.CsvMixin, RecordReader<T>
CsvRecordReader
is an implementation of the Records
interface and provides functionality to parse CSV input streams.org.refcodes.textual.CsvEscapeModeAccessor.CsvEscapeModeBuilder<B extends org.refcodes.textual.CsvEscapeModeAccessor.CsvEscapeModeBuilder<?>>, org.refcodes.textual.CsvEscapeModeAccessor.CsvEscapeModeMutator, org.refcodes.textual.CsvEscapeModeAccessor.CsvEscapeModeProperty
org.refcodes.mixin.DelimiterAccessor.DelimiterBuilder<B extends org.refcodes.mixin.DelimiterAccessor.DelimiterBuilder<B>>, org.refcodes.mixin.DelimiterAccessor.DelimiterMutator, org.refcodes.mixin.DelimiterAccessor.DelimiterProperty
HeaderAccessor.HeaderBuilder<T extends HeaderAccessor.HeaderBuilder<?>>, HeaderAccessor.HeaderMutator<T>, HeaderAccessor.HeaderProperty<T>
Modifier | Constructor | Description |
---|---|---|
|
CsvRecordReader(ColumnFactory<T> aColumnFactory,
File aCsvFile) |
Constructs a
CsvRecordReader with the given parameters. |
|
CsvRecordReader(ColumnFactory<T> aColumnFactory,
File aCsvFile,
boolean isStrict) |
Constructs a
CsvRecordReader with the given parameters. |
|
CsvRecordReader(ColumnFactory<T> aColumnFactory,
File aCsvFile,
char aCsvSeparator) |
Constructs a
CsvRecordReader with the given parameters. |
|
CsvRecordReader(ColumnFactory<T> aColumnFactory,
File aCsvFile,
char aCsvSeparator,
boolean isStrict) |
Constructs a
CsvRecordReader with the given parameters. |
|
CsvRecordReader(ColumnFactory<T> aColumnFactory,
File aCsvFile,
Charset aEncoding) |
Constructs a
CsvRecordReader with the given parameters. |
|
CsvRecordReader(ColumnFactory<T> aColumnFactory,
File aCsvFile,
Charset aEncoding,
boolean isStrict) |
Constructs a
CsvRecordReader with the given parameters. |
|
CsvRecordReader(ColumnFactory<T> aColumnFactory,
File aCsvFile,
Charset aEncoding,
char aCsvSeparator) |
Constructs a
CsvRecordReader with the given parameters. |
|
CsvRecordReader(ColumnFactory<T> aColumnFactory,
File aCsvFile,
Charset aEncoding,
char aCsvSeparator,
boolean isStrict) |
Constructs a
CsvRecordReader with the given parameters. |
|
CsvRecordReader(ColumnFactory<T> aColumnFactory,
InputStream aCsvInputStream) |
Constructs a
CsvRecordReader with the given parameters. |
|
CsvRecordReader(ColumnFactory<T> aColumnFactory,
InputStream aCsvInputStream,
boolean isStrict) |
Constructs a
CsvRecordReader with the given parameters. |
|
CsvRecordReader(ColumnFactory<T> aColumnFactory,
InputStream aCsvInputStream,
char aCsvDelimiter) |
Constructs a
CsvRecordReader with the given parameters. |
|
CsvRecordReader(ColumnFactory<T> aColumnFactory,
InputStream aCsvInputStream,
char aCsvDelimiter,
boolean isStrict) |
Constructs a
CsvRecordReader with the given parameters. |
|
CsvRecordReader(ColumnFactory<T> aColumnFactory,
InputStream aCsvInputStream,
Charset aEncoding) |
Constructs a
CsvRecordReader with the given parameters. |
|
CsvRecordReader(ColumnFactory<T> aColumnFactory,
InputStream aCsvInputStream,
Charset aEncoding,
boolean isStrict) |
Constructs a
CsvRecordReader with the given parameters. |
|
CsvRecordReader(ColumnFactory<T> aColumnFactory,
InputStream aCsvInputStream,
Charset aEncoding,
char aCsvDelimiter) |
Constructs a
CsvRecordReader with the given parameters. |
|
CsvRecordReader(ColumnFactory<T> aColumnFactory,
InputStream aCsvInputStream,
Charset aEncoding,
char aCsvDelimiter,
boolean isStrict) |
Constructs a
CsvRecordReader with the given parameters. |
|
CsvRecordReader(Header<T> aHeader,
File aCsvFile) |
Constructs a
CsvRecordReader with the given parameters. |
|
CsvRecordReader(Header<T> aHeader,
File aCsvFile,
boolean isStrict) |
Constructs a
CsvRecordReader with the given parameters. |
|
CsvRecordReader(Header<T> aHeader,
File aCsvFile,
char aCsvSeparator) |
Constructs a
CsvRecordReader with the given parameters. |
|
CsvRecordReader(Header<T> aHeader,
File aCsvFile,
char aCsvSeparator,
boolean isStrict) |
Constructs a
CsvRecordReader with the given parameters. |
|
CsvRecordReader(Header<T> aHeader,
File aCsvFile,
Charset aEncoding) |
Constructs a
CsvRecordReader with the given parameters. |
|
CsvRecordReader(Header<T> aHeader,
File aCsvFile,
Charset aEncoding,
boolean isStrict) |
Constructs a
CsvRecordReader with the given parameters. |
|
CsvRecordReader(Header<T> aHeader,
File aCsvFile,
Charset aEncoding,
char aCsvSeparator) |
Constructs a
CsvRecordReader with the given parameters. |
|
CsvRecordReader(Header<T> aHeader,
File aCsvFile,
Charset aEncoding,
char aCsvSeparator,
boolean isStrict) |
Constructs a
CsvRecordReader with the given parameters. |
|
CsvRecordReader(Header<T> aHeader,
InputStream aCsvInputStream) |
Constructs a
CsvRecordReader with the given parameters. |
|
CsvRecordReader(Header<T> aHeader,
InputStream aCsvInputStream,
boolean isStrict) |
Constructs a
CsvRecordReader with the given parameters. |
|
CsvRecordReader(Header<T> aHeader,
InputStream aCsvInputStream,
char aCsvDelimiter) |
Constructs a
CsvRecordReader with the given parameters. |
|
CsvRecordReader(Header<T> aHeader,
InputStream aCsvInputStream,
char aCsvDelimiter,
boolean isStrict) |
Constructs a
CsvRecordReader with the given parameters. |
|
CsvRecordReader(Header<T> aHeader,
InputStream aCsvInputStream,
Charset aEncoding) |
Constructs a
CsvRecordReader with the given parameters. |
|
CsvRecordReader(Header<T> aHeader,
InputStream aCsvInputStream,
Charset aEncoding,
boolean isStrict) |
Constructs a
CsvRecordReader with the given parameters. |
|
CsvRecordReader(Header<T> aHeader,
InputStream aCsvInputStream,
Charset aEncoding,
char aCsvDelimiter) |
Constructs a
CsvRecordReader with the given parameters. |
|
CsvRecordReader(Header<T> aHeader,
InputStream aCsvInputStream,
Charset aEncoding,
char aCsvDelimiter,
boolean isStrict) |
Constructs a
CsvRecordReader with the given parameters. |
protected |
CsvRecordReader(Header<T> aHeader,
ColumnFactory<T> aColumnFactory,
InputStream aCsvInputStream,
Charset aEncoding,
char aCsvDelimiter,
boolean isStrict) |
Constructs a
CsvRecordReader with the given parameters. |
Modifier and Type | Method | Description |
---|---|---|
void |
clearCommentPrefixes() |
|
void |
close() |
|
String[] |
getCommentPrefixes() |
|
org.refcodes.textual.CsvEscapeMode |
getCsvEscapeMode() |
|
char |
getDelimiter() |
|
long |
getErroneousRecordCount() |
Gets the erroneous record count.
|
Header<T> |
getHeader() |
Retrieves the
Header property. |
boolean |
hasNext() |
|
boolean |
isTrim() |
|
Record<T> |
next() |
|
Header<T> |
readHeader() |
Creates a
Header from the next line to be read . |
String[] |
readNext() |
Reads the next line from the (standard) input (stream or file) and
returns an array of its
String representation. |
void |
remove() |
|
void |
setCommentPrefixes(String... aCommentPrefixes) |
|
void |
setCsvEscapeMode(org.refcodes.textual.CsvEscapeMode aCsvEscapeMode) |
|
void |
setDelimiter(char aCsvDelimiter) |
|
void |
setTrim(boolean isTrim) |
|
String |
skipHeader() |
Skips the next line to be read.
|
org.refcodes.textual.CsvMixin |
withCommentPrefixes(String... aCommentPrefixes) |
|
CsvRecordReader<T> |
withCsvEscapeMode(org.refcodes.textual.CsvEscapeMode aCsvEscapeMode) |
|
CsvRecordReader<T> |
withDelimiter(char aCsvDelimiter) |
|
CsvRecordReader<T> |
withTrim(boolean isTrim) |
letCsvEscapeMode
letDelimiter
forEach, spliterator
forEachRemaining
public CsvRecordReader(Header<T> aHeader, File aCsvFile) throws FileNotFoundException, IOException, ZipException
CsvRecordReader
with the given parameters.
Internally Column
instances are generated according to the keys
found in the CSV top line. The Column
instances are required to
convert the CSV line values. If a Header
is provided, then the
Header
is used for generating the Column
instances
instead of the top line of the CSV file.aHeader
- The Header
to use when parsing the lines retrieved
from the InputStream
.aCsvFile
- The CSV File
which to parse.FileNotFoundException
- the file not found exceptionIOException
- in case there were problems working with the given
File
.ZipException
- the zip exceptionpublic CsvRecordReader(Header<T> aHeader, File aCsvFile, char aCsvSeparator) throws FileNotFoundException, IOException, ZipException
CsvRecordReader
with the given parameters.
Internally Column
instances are generated according to the keys
found in the CSV top line. The Column
instances are required to
convert the CSV line values. If a Header
is provided, then the
Header
is used for generating the Column
instances
instead of the top line of the CSV file.aHeader
- The Header
to use when parsing the lines retrieved
from the InputStream
.aCsvFile
- The CSV File
which to parse.aCsvSeparator
- The delimiter being expected for the CSV input
stream.FileNotFoundException
- the file not found exceptionIOException
- in case there were problems working with the given
File
.ZipException
- the zip exceptionpublic CsvRecordReader(Header<T> aHeader, File aCsvFile, boolean isStrict) throws FileNotFoundException, IOException, ZipException
CsvRecordReader
with the given parameters.
Internally Column
instances are generated according to the keys
found in the CSV top line. The Column
instances are required to
convert the CSV line values. If a Header
is provided, then the
Header
is used for generating the Column
instances
instead of the top line of the CSV file.aHeader
- The Header
to use when parsing the lines retrieved
from the InputStream
.aCsvFile
- The CSV File
which to parse.isStrict
- When true, then parsing will abort with an exception in
case of parsing problems, else parsing is gracefully continued and
erroneous records are skipped. The error count
getErroneousRecordCount()
is incremented by each
erroneous Record
.FileNotFoundException
- the file not found exceptionIOException
- in case there were problems working with the given
File
.ZipException
- the zip exceptionpublic CsvRecordReader(Header<T> aHeader, File aCsvFile, char aCsvSeparator, boolean isStrict) throws FileNotFoundException, IOException, ZipException
CsvRecordReader
with the given parameters.
Internally Column
instances are generated according to the keys
found in the CSV top line. The Column
instances are required to
convert the CSV line values. If a Header
is provided, then the
Header
is used for generating the Column
instances
instead of the top line of the CSV file.aHeader
- The Header
to use when parsing the lines retrieved
from the InputStream
.aCsvFile
- The CSV File
which to parse.aCsvSeparator
- The delimiter being expected for the CSV input
stream.isStrict
- When true, then parsing will abort with an exception in
case of parsing problems, else parsing is gracefully continued and
erroneous records are skipped. The error count
getErroneousRecordCount()
is incremented by each
erroneous Record
.FileNotFoundException
- the file not found exceptionIOException
- in case there were problems working with the given
File
.ZipException
- the zip exceptionpublic CsvRecordReader(ColumnFactory<T> aColumnFactory, File aCsvFile) throws FileNotFoundException, IOException, ZipException
CsvRecordReader
with the given parameters. This
constructor supports a ColumnFactory
for creating Column
instance according to the keys found in the CSV top line. The
Column
instances are required to convert the CSV line values from
the storage format to the actual required type.aColumnFactory
- A ColumnFactory
to be used to generate
Column
instances from the top line of the CSF file,
required for parsing the CSV lines and converting them to
Record
instances.aCsvFile
- The CSV File
which to parse.FileNotFoundException
- the file not found exceptionIOException
- in case there were problems working with the given
File
.ZipException
- the zip exceptionpublic CsvRecordReader(ColumnFactory<T> aColumnFactory, File aCsvFile, char aCsvSeparator) throws FileNotFoundException, IOException, ZipException
CsvRecordReader
with the given parameters. This
constructor supports a ColumnFactory
for creating Column
instance according to the keys found in the CSV top line. The
Column
instances are required to convert the CSV line values from
the storage format to the actual required type.aColumnFactory
- A ColumnFactory
to be used to generate
Column
instances from the top line of the CSF file,
required for parsing the CSV lines and converting them to
Record
instances.aCsvFile
- The CSV File
which to parse.aCsvSeparator
- The delimiter being expected for the CSV input
stream.FileNotFoundException
- the file not found exceptionIOException
- in case there were problems working with the given
File
.ZipException
- the zip exceptionpublic CsvRecordReader(ColumnFactory<T> aColumnFactory, File aCsvFile, boolean isStrict) throws FileNotFoundException, IOException, ZipException
CsvRecordReader
with the given parameters. This
constructor supports a ColumnFactory
for creating Column
instance according to the keys found in the CSV top line. The
Column
instances are required to convert the CSV line values from
the storage format to the actual required type.aColumnFactory
- A ColumnFactory
to be used to generate
Column
instances from the top line of the CSF file,
required for parsing the CSV lines and converting them to
Record
instances.aCsvFile
- The CSV File
which to parse.isStrict
- When true, then parsing will abort with an exception in
case of parsing problems, else parsing is gracefully continued and
erroneous records are skipped. The error count
getErroneousRecordCount()
is incremented by each
erroneous Record
.FileNotFoundException
- the file not found exceptionIOException
- in case there were problems working with the given
File
.ZipException
- the zip exceptionpublic CsvRecordReader(ColumnFactory<T> aColumnFactory, File aCsvFile, char aCsvSeparator, boolean isStrict) throws FileNotFoundException, IOException, ZipException
CsvRecordReader
with the given parameters. This
constructor supports a ColumnFactory
for creating Column
instance according to the keys found in the CSV top line. The
Column
instances are required to convert the CSV line values from
the storage format to the actual required type.aColumnFactory
- A ColumnFactory
to be used to generate
Column
instances from the top line of the CSF file,
required for parsing the CSV lines and converting them to
Record
instances.aCsvFile
- The CSV File
which to parse.aCsvSeparator
- The delimiter being expected for the CSV input
stream.isStrict
- When true, then parsing will abort with an exception in
case of parsing problems, else parsing is gracefully continued and
erroneous records are skipped. The error count
getErroneousRecordCount()
is incremented by each
erroneous Record
.FileNotFoundException
- the file not found exceptionIOException
- in case there were problems working with the given
File
.ZipException
- the zip exceptionpublic CsvRecordReader(Header<T> aHeader, InputStream aCsvInputStream) throws IOException
CsvRecordReader
with the given parameters.
Internally Column
instances are generated according to the keys
found in the CSV top line. The Column
instances are required to
convert the CSV line values. If a Header
is provided, then the
Header
is used for generating the Column
instances
instead of the top line of the CSV file.aHeader
- The Header
to use when parsing the lines retrieved
from the InputStream
.aCsvInputStream
- The CSV InputStream
which to parse.IOException
- in case there were problems working with the given
InputStream
.public CsvRecordReader(Header<T> aHeader, InputStream aCsvInputStream, boolean isStrict) throws IOException
CsvRecordReader
with the given parameters.
Internally Column
instances are generated according to the keys
found in the CSV top line. The Column
instances are required to
convert the CSV line values. If a Header
is provided, then the
Header
is used for generating the Column
instances
instead of the top line of the CSV file.aHeader
- The Header
to use when parsing the lines retrieved
from the InputStream
.aCsvInputStream
- The CSV InputStream
which to parse.isStrict
- When true, then parsing will abort with an exception in
case of parsing problems, else parsing is gracefully continued and
erroneous records are skipped. The error count
getErroneousRecordCount()
is incremented by each
erroneous Record
.IOException
- in case there were problems working with the given
InputStream
.public CsvRecordReader(Header<T> aHeader, InputStream aCsvInputStream, char aCsvDelimiter) throws IOException
CsvRecordReader
with the given parameters.
Internally Column
instances are generated according to the keys
found in the CSV top line. The Column
instances are required to
convert the CSV line values. If a Header
is provided, then the
Header
is used for generating the Column
instances
instead of the top line of the CSV file.aHeader
- The Header
to use when parsing the lines retrieved
from the InputStream
.aCsvInputStream
- The CSV InputStream
which to parse.aCsvDelimiter
- The delimiter being expected for the CSV input
stream.IOException
- in case there were problems working with the given
InputStream
.public CsvRecordReader(Header<T> aHeader, InputStream aCsvInputStream, char aCsvDelimiter, boolean isStrict) throws IOException
CsvRecordReader
with the given parameters.
Internally Column
instances are generated according to the keys
found in the CSV top line. The Column
instances are required to
convert the CSV line values. If a Header
is provided, then the
Header
is used for generating the Column
instances
instead of the top line of the CSV file.aHeader
- The Header
to use when parsing the lines retrieved
from the InputStream
.aCsvInputStream
- The CSV InputStream
which to parse.aCsvDelimiter
- The delimiter being expected for the CSV input
stream.isStrict
- When true, then parsing will abort with an exception in
case of parsing problems, else parsing is gracefully continued and
erroneous records are skipped. The error count
getErroneousRecordCount()
is incremented by each
erroneous Record
.IOException
- in case there were problems working with the given
InputStream
.public CsvRecordReader(ColumnFactory<T> aColumnFactory, InputStream aCsvInputStream) throws IOException
CsvRecordReader
with the given parameters. This
constructor supports a ColumnFactory
for creating Column
instance according to the keys found in the CSV top line. The
Column
instances are required to convert the CSV line values from
the storage format to the actual required type.aColumnFactory
- A ColumnFactory
to be used to generate
Column
instances from the top line of the CSF file,
required for parsing the CSV lines and converting them to
Record
instances.aCsvInputStream
- The CSV InputStream
which to parse.IOException
- in case there were problems working with the given
InputStream
.public CsvRecordReader(ColumnFactory<T> aColumnFactory, InputStream aCsvInputStream, boolean isStrict) throws IOException
CsvRecordReader
with the given parameters. This
constructor supports a ColumnFactory
for creating Column
instance according to the keys found in the CSV top line. The
Column
instances are required to convert the CSV line values from
the storage format to the actual required type.aColumnFactory
- A ColumnFactory
to be used to generate
Column
instances from the top line of the CSF file,
required for parsing the CSV lines and converting them to
Record
instances.aCsvInputStream
- The CSV InputStream
which to parse.isStrict
- When true, then parsing will abort with an exception in
case of parsing problems, else parsing is gracefully continued and
erroneous records are skipped. The error count
getErroneousRecordCount()
is incremented by each
erroneous Record
.IOException
- in case there were problems working with the given
InputStream
.public CsvRecordReader(ColumnFactory<T> aColumnFactory, InputStream aCsvInputStream, char aCsvDelimiter) throws IOException
CsvRecordReader
with the given parameters. This
constructor supports a ColumnFactory
for creating Column
instance according to the keys found in the CSV top line. The
Column
instances are required to convert the CSV line values from
the storage format to the actual required type.aColumnFactory
- A ColumnFactory
to be used to generate
Column
instances from the top line of the CSF file,
required for parsing the CSV lines and converting them to
Record
instances.aCsvInputStream
- The CSV InputStream
which to parse.aCsvDelimiter
- The delimiter being expected for the CSV input
stream.IOException
- in case there were problems working with the given
InputStream
.public CsvRecordReader(ColumnFactory<T> aColumnFactory, InputStream aCsvInputStream, char aCsvDelimiter, boolean isStrict) throws IOException
CsvRecordReader
with the given parameters. This
constructor supports a ColumnFactory
for creating Column
instance according to the keys found in the CSV top line. The
Column
instances are required to convert the CSV line values from
the storage format to the actual required type.aColumnFactory
- A ColumnFactory
to be used to generate
Column
instances from the top line of the CSF file,
required for parsing the CSV lines and converting them to
Record
instances.aCsvInputStream
- The CSV InputStream
which to parse.aCsvDelimiter
- The delimiter being expected for the CSV input
stream.isStrict
- When true, then parsing will abort with an exception in
case of parsing problems, else parsing is gracefully continued and
erroneous records are skipped. The error count
getErroneousRecordCount()
is incremented by each
erroneous Record
.IOException
- in case there were problems working with the given
InputStream
.public CsvRecordReader(Header<T> aHeader, File aCsvFile, Charset aEncoding) throws FileNotFoundException, IOException, ZipException
CsvRecordReader
with the given parameters.
Internally Column
instances are generated according to the keys
found in the CSV top line. The Column
instances are required to
convert the CSV line values. If a Header
is provided, then the
Header
is used for generating the Column
instances
instead of the top line of the CSV file.aHeader
- The Header
to use when parsing the lines retrieved
from the InputStream
.aCsvFile
- The CSV File
which to parse.aEncoding
- The Charset
for the character encoding to use.FileNotFoundException
- the file not found exceptionIOException
- in case there were problems working with the given
File
.ZipException
- the zip exceptionpublic CsvRecordReader(Header<T> aHeader, File aCsvFile, Charset aEncoding, char aCsvSeparator) throws FileNotFoundException, IOException, ZipException
CsvRecordReader
with the given parameters.
Internally Column
instances are generated according to the keys
found in the CSV top line. The Column
instances are required to
convert the CSV line values. If a Header
is provided, then the
Header
is used for generating the Column
instances
instead of the top line of the CSV file.aHeader
- The Header
to use when parsing the lines retrieved
from the InputStream
.aCsvFile
- The CSV File
which to parse.aEncoding
- The Charset
for the character encoding to use.aCsvSeparator
- The delimiter being expected for the CSV input
stream.FileNotFoundException
- the file not found exceptionIOException
- in case there were problems working with the given
File
.ZipException
- the zip exceptionpublic CsvRecordReader(Header<T> aHeader, File aCsvFile, Charset aEncoding, boolean isStrict) throws FileNotFoundException, IOException, ZipException
CsvRecordReader
with the given parameters.
Internally Column
instances are generated according to the keys
found in the CSV top line. The Column
instances are required to
convert the CSV line values. If a Header
is provided, then the
Header
is used for generating the Column
instances
instead of the top line of the CSV file.aHeader
- The Header
to use when parsing the lines retrieved
from the InputStream
.aCsvFile
- The CSV File
which to parse.aEncoding
- The Charset
for the character encoding to use.isStrict
- When true, then parsing will abort with an exception in
case of parsing problems, else parsing is gracefully continued and
erroneous records are skipped. The error count
getErroneousRecordCount()
is incremented by each
erroneous Record
.FileNotFoundException
- the file not found exceptionIOException
- in case there were problems working with the given
File
.ZipException
- the zip exceptionpublic CsvRecordReader(Header<T> aHeader, File aCsvFile, Charset aEncoding, char aCsvSeparator, boolean isStrict) throws FileNotFoundException, IOException, ZipException
CsvRecordReader
with the given parameters.
Internally Column
instances are generated according to the keys
found in the CSV top line. The Column
instances are required to
convert the CSV line values. If a Header
is provided, then the
Header
is used for generating the Column
instances
instead of the top line of the CSV file.aHeader
- The Header
to use when parsing the lines retrieved
from the InputStream
.aCsvFile
- The CSV File
which to parse.aEncoding
- The Charset
for the character encoding to use.aCsvSeparator
- The delimiter being expected for the CSV input
stream.isStrict
- When true, then parsing will abort with an exception in
case of parsing problems, else parsing is gracefully continued and
erroneous records are skipped. The error count
getErroneousRecordCount()
is incremented by each
erroneous Record
.FileNotFoundException
- the file not found exceptionIOException
- in case there were problems working with the given
File
.ZipException
- the zip exceptionpublic CsvRecordReader(ColumnFactory<T> aColumnFactory, File aCsvFile, Charset aEncoding) throws FileNotFoundException, IOException, ZipException
CsvRecordReader
with the given parameters. This
constructor supports a ColumnFactory
for creating Column
instance according to the keys found in the CSV top line. The
Column
instances are required to convert the CSV line values from
the storage format to the actual required type.aColumnFactory
- A ColumnFactory
to be used to generate
Column
instances from the top line of the CSF file,
required for parsing the CSV lines and converting them to
Record
instances.aCsvFile
- The CSV File
which to parse.aEncoding
- The Charset
for the character encoding to use.FileNotFoundException
- the file not found exceptionIOException
- in case there were problems working with the given
File
.ZipException
- the zip exceptionpublic CsvRecordReader(ColumnFactory<T> aColumnFactory, File aCsvFile, Charset aEncoding, char aCsvSeparator) throws FileNotFoundException, IOException, ZipException
CsvRecordReader
with the given parameters. This
constructor supports a ColumnFactory
for creating Column
instance according to the keys found in the CSV top line. The
Column
instances are required to convert the CSV line values from
the storage format to the actual required type.aColumnFactory
- A ColumnFactory
to be used to generate
Column
instances from the top line of the CSF file,
required for parsing the CSV lines and converting them to
Record
instances.aCsvFile
- The CSV File
which to parse.aEncoding
- The Charset
for the character encoding to use.aCsvSeparator
- The delimiter being expected for the CSV input
stream.FileNotFoundException
- the file not found exceptionIOException
- in case there were problems working with the given
File
.ZipException
- the zip exceptionpublic CsvRecordReader(ColumnFactory<T> aColumnFactory, File aCsvFile, Charset aEncoding, boolean isStrict) throws FileNotFoundException, IOException, ZipException
CsvRecordReader
with the given parameters. This
constructor supports a ColumnFactory
for creating Column
instance according to the keys found in the CSV top line. The
Column
instances are required to convert the CSV line values from
the storage format to the actual required type.aColumnFactory
- A ColumnFactory
to be used to generate
Column
instances from the top line of the CSF file,
required for parsing the CSV lines and converting them to
Record
instances.aCsvFile
- The CSV File
which to parse.aEncoding
- The Charset
for the character encoding to use.isStrict
- When true, then parsing will abort with an exception in
case of parsing problems, else parsing is gracefully continued and
erroneous records are skipped. The error count
getErroneousRecordCount()
is incremented by each
erroneous Record
.FileNotFoundException
- the file not found exceptionIOException
- in case there were problems working with the given
File
.ZipException
- the zip exceptionpublic CsvRecordReader(ColumnFactory<T> aColumnFactory, File aCsvFile, Charset aEncoding, char aCsvSeparator, boolean isStrict) throws FileNotFoundException, IOException, ZipException
CsvRecordReader
with the given parameters. This
constructor supports a ColumnFactory
for creating Column
instance according to the keys found in the CSV top line. The
Column
instances are required to convert the CSV line values from
the storage format to the actual required type.aColumnFactory
- A ColumnFactory
to be used to generate
Column
instances from the top line of the CSF file,
required for parsing the CSV lines and converting them to
Record
instances.aCsvFile
- The CSV File
which to parse.aEncoding
- The Charset
for the character encoding to use.aCsvSeparator
- The delimiter being expected for the CSV input
stream.isStrict
- When true, then parsing will abort with an exception in
case of parsing problems, else parsing is gracefully continued and
erroneous records are skipped. The error count
getErroneousRecordCount()
is incremented by each
erroneous Record
.FileNotFoundException
- the file not found exceptionIOException
- in case there were problems working with the given
File
.ZipException
- the zip exceptionpublic CsvRecordReader(Header<T> aHeader, InputStream aCsvInputStream, Charset aEncoding) throws IOException
CsvRecordReader
with the given parameters.
Internally Column
instances are generated according to the keys
found in the CSV top line. The Column
instances are required to
convert the CSV line values. If a Header
is provided, then the
Header
is used for generating the Column
instances
instead of the top line of the CSV file.aHeader
- The Header
to use when parsing the lines retrieved
from the InputStream
.aCsvInputStream
- The CSV InputStream
which to parse.aEncoding
- The Charset
for the character encoding to use.IOException
- in case there were problems working with the given
InputStream
.public CsvRecordReader(Header<T> aHeader, InputStream aCsvInputStream, Charset aEncoding, boolean isStrict) throws IOException
CsvRecordReader
with the given parameters.
Internally Column
instances are generated according to the keys
found in the CSV top line. The Column
instances are required to
convert the CSV line values. If a Header
is provided, then the
Header
is used for generating the Column
instances
instead of the top line of the CSV file.aHeader
- The Header
to use when parsing the lines retrieved
from the InputStream
.aCsvInputStream
- The CSV InputStream
which to parse.aEncoding
- The Charset
for the character encoding to use.isStrict
- When true, then parsing will abort with an exception in
case of parsing problems, else parsing is gracefully continued and
erroneous records are skipped. The error count
getErroneousRecordCount()
is incremented by each
erroneous Record
.IOException
- in case there were problems working with the given
InputStream
.public CsvRecordReader(Header<T> aHeader, InputStream aCsvInputStream, Charset aEncoding, char aCsvDelimiter) throws IOException
CsvRecordReader
with the given parameters.
Internally Column
instances are generated according to the keys
found in the CSV top line. The Column
instances are required to
convert the CSV line values. If a Header
is provided, then the
Header
is used for generating the Column
instances
instead of the top line of the CSV file.aHeader
- The Header
to use when parsing the lines retrieved
from the InputStream
.aCsvInputStream
- The CSV InputStream
which to parse.aCsvDelimiter
- The delimiter being expected for the CSV input
stream.IOException
- in case there were problems working with the given
InputStream
.public CsvRecordReader(Header<T> aHeader, InputStream aCsvInputStream, Charset aEncoding, char aCsvDelimiter, boolean isStrict) throws IOException
CsvRecordReader
with the given parameters.
Internally Column
instances are generated according to the keys
found in the CSV top line. The Column
instances are required to
convert the CSV line values. If a Header
is provided, then the
Header
is used for generating the Column
instances
instead of the top line of the CSV file.aHeader
- The Header
to use when parsing the lines retrieved
from the InputStream
.aCsvInputStream
- The CSV InputStream
which to parse.aEncoding
- The Charset
for the character encoding to use.aCsvDelimiter
- The delimiter being expected for the CSV input
stream.isStrict
- When true, then parsing will abort with an exception in
case of parsing problems, else parsing is gracefully continued and
erroneous records are skipped. The error count
getErroneousRecordCount()
is incremented by each
erroneous Record
.IOException
- in case there were problems working with the given
InputStream
.public CsvRecordReader(ColumnFactory<T> aColumnFactory, InputStream aCsvInputStream, Charset aEncoding) throws IOException
CsvRecordReader
with the given parameters. This
constructor supports a ColumnFactory
for creating Column
instance according to the keys found in the CSV top line. The
Column
instances are required to convert the CSV line values from
the storage format to the actual required type.aColumnFactory
- A ColumnFactory
to be used to generate
Column
instances from the top line of the CSF file,
required for parsing the CSV lines and converting them to
Record
instances.aCsvInputStream
- The CSV InputStream
which to parse.aEncoding
- The Charset
for the character encoding to use.IOException
- in case there were problems working with the given
InputStream
.public CsvRecordReader(ColumnFactory<T> aColumnFactory, InputStream aCsvInputStream, Charset aEncoding, boolean isStrict) throws IOException
CsvRecordReader
with the given parameters. This
constructor supports a ColumnFactory
for creating Column
instance according to the keys found in the CSV top line. The
Column
instances are required to convert the CSV line values from
the storage format to the actual required type.aColumnFactory
- A ColumnFactory
to be used to generate
Column
instances from the top line of the CSF file,
required for parsing the CSV lines and converting them to
Record
instances.aCsvInputStream
- The CSV InputStream
which to parse.aEncoding
- The Charset
for the character encoding to use.isStrict
- When true, then parsing will abort with an exception in
case of parsing problems, else parsing is gracefully continued and
erroneous records are skipped. The error count
getErroneousRecordCount()
is incremented by each
erroneous Record
.IOException
- in case there were problems working with the given
InputStream
.public CsvRecordReader(ColumnFactory<T> aColumnFactory, InputStream aCsvInputStream, Charset aEncoding, char aCsvDelimiter) throws IOException
CsvRecordReader
with the given parameters. This
constructor supports a ColumnFactory
for creating Column
instance according to the keys found in the CSV top line. The
Column
instances are required to convert the CSV line values from
the storage format to the actual required type.aColumnFactory
- A ColumnFactory
to be used to generate
Column
instances from the top line of the CSF file,
required for parsing the CSV lines and converting them to
Record
instances.aCsvInputStream
- The CSV InputStream
which to parse.aEncoding
- The Charset
for the character encoding to use.aCsvDelimiter
- The delimiter being expected for the CSV input
stream.IOException
- in case there were problems working with the given
InputStream
.public CsvRecordReader(ColumnFactory<T> aColumnFactory, InputStream aCsvInputStream, Charset aEncoding, char aCsvDelimiter, boolean isStrict) throws IOException
CsvRecordReader
with the given parameters. This
constructor supports a ColumnFactory
for creating Column
instance according to the keys found in the CSV top line. The
Column
instances are required to convert the CSV line values from
the storage format to the actual required type.aColumnFactory
- A ColumnFactory
to be used to generate
Column
instances from the top line of the CSF file,
required for parsing the CSV lines and converting them to
Record
instances.aCsvInputStream
- The CSV InputStream
which to parse.aEncoding
- The Charset
for the character encoding to use.aCsvDelimiter
- The delimiter being expected for the CSV input
stream.isStrict
- When true, then parsing will abort with an exception in
case of parsing problems, else parsing is gracefully continued and
erroneous records are skipped. The error count
getErroneousRecordCount()
is incremented by each
erroneous Record
.IOException
- in case there were problems working with the given
InputStream
.protected CsvRecordReader(Header<T> aHeader, ColumnFactory<T> aColumnFactory, InputStream aCsvInputStream, Charset aEncoding, char aCsvDelimiter, boolean isStrict) throws IOException
CsvRecordReader
with the given parameters. This
constructor supports a ColumnFactory
for creating Column
instance according to the keys found in the CSV top line. The
Column
instances are required to convert the CSV line values from
the storage format to the actual required type. If a Header
is
provided, then the Header
is used for generating the
Column
instances instead of the top line of the CSV file.aHeader
- The Header
to use when parsing the lines retrieved
from the InputStream
.aColumnFactory
- A ColumnFactory
to be used to generate
Column
instances from the top line of the CSF file,
required for parsing the CSV lines and converting them to
Record
instances.aCsvInputStream
- The CSV InputStream
which to parse.aEncoding
- The Charset
for the character encoding to use.aCsvDelimiter
- The delimiter being expected for the CSV input
stream.isStrict
- When true, then parsing will abort with an exception in
case of parsing problems, else parsing is gracefully continued and
erroneous records are skipped. The error count
getErroneousRecordCount()
is incremented by each
erroneous Record
.IOException
- in case there were problems working with the given
InputStream
.public Header<T> readHeader() throws IOException
Header
from the next line to be read .readHeader
in interface RecordReader<T>
Header
being read.IOException
- thrown in case reading from IO failed.public String skipHeader() throws IOException
Iterator.next()
method. This methods is useful when skipping the first
line (header).skipHeader
in interface RecordReader<T>
IOException
- thrown in case if IO problems.public boolean hasNext()
public String[] readNext()
String
representation.public Header<T> getHeader()
Header
property.getHeader
in interface HeaderAccessor<T>
Header
being stored by this property.public void setCommentPrefixes(String... aCommentPrefixes)
setCommentPrefixes
in interface org.refcodes.textual.CsvMixin
public String[] getCommentPrefixes()
getCommentPrefixes
in interface org.refcodes.textual.CsvMixin
public void clearCommentPrefixes()
clearCommentPrefixes
in interface org.refcodes.textual.CsvMixin
public org.refcodes.textual.CsvMixin withCommentPrefixes(String... aCommentPrefixes)
withCommentPrefixes
in interface org.refcodes.textual.CsvMixin
public void close() throws IOException
close
in interface AutoCloseable
IOException
public org.refcodes.textual.CsvEscapeMode getCsvEscapeMode()
getCsvEscapeMode
in interface org.refcodes.textual.CsvEscapeModeAccessor
public boolean isTrim()
isTrim
in interface org.refcodes.mixin.TrimAccessor
public char getDelimiter()
getDelimiter
in interface org.refcodes.mixin.DelimiterAccessor
public void setTrim(boolean isTrim)
setTrim
in interface org.refcodes.mixin.TrimAccessor.TrimMutator
public void setDelimiter(char aCsvDelimiter)
setDelimiter
in interface org.refcodes.mixin.DelimiterAccessor.DelimiterMutator
public CsvRecordReader<T> withTrim(boolean isTrim)
withTrim
in interface org.refcodes.mixin.TrimAccessor.TrimBuilder<T>
public CsvRecordReader<T> withCsvEscapeMode(org.refcodes.textual.CsvEscapeMode aCsvEscapeMode)
withCsvEscapeMode
in interface org.refcodes.textual.CsvEscapeModeAccessor.CsvEscapeModeBuilder<T>
public CsvRecordReader<T> withDelimiter(char aCsvDelimiter)
withDelimiter
in interface org.refcodes.mixin.DelimiterAccessor.DelimiterBuilder<T>
public void setCsvEscapeMode(org.refcodes.textual.CsvEscapeMode aCsvEscapeMode)
setCsvEscapeMode
in interface org.refcodes.textual.CsvEscapeModeAccessor.CsvEscapeModeMutator
public long getErroneousRecordCount()
getErroneousRecordCount
in interface RecordReader<T>
Copyright © 2021. All rights reserved.