T
- The type managed by the Records
.public class CsvInputStreamRecordsImpl<T> extends Object implements InputStreamRecords<T>
CsvInputStreamRecordsImpl
is an implementation of the
Records
interface and provides functionality to parse CSV input
streams.
TODO: This class is still to be unit tested.
HeaderAccessor.HeaderMutator<T>, HeaderAccessor.HeaderProperty<T>
Modifier | Constructor and Description |
---|---|
|
CsvInputStreamRecordsImpl(ColumnFactory<T> aColumnFactory,
InputStream aCsvInputStream)
Constructs a
CsvInputStreamRecordsImpl with the given parameters. |
|
CsvInputStreamRecordsImpl(ColumnFactory<T> aColumnFactory,
InputStream aCsvInputStream,
boolean isStrict)
Constructs a
CsvInputStreamRecordsImpl with the given parameters. |
|
CsvInputStreamRecordsImpl(ColumnFactory<T> aColumnFactory,
InputStream aCsvInputStream,
char aCsvDelimiter)
Constructs a
CsvInputStreamRecordsImpl with the given parameters. |
|
CsvInputStreamRecordsImpl(ColumnFactory<T> aColumnFactory,
InputStream aCsvInputStream,
char aCsvDelimiter,
boolean isStrict)
Constructs a
CsvInputStreamRecordsImpl with the given parameters. |
protected |
CsvInputStreamRecordsImpl(Header<T> aHeader,
ColumnFactory<T> aColumnFactory,
InputStream aCsvInputStream,
char aCsvDelimiter,
boolean isStrict)
Constructs a
CsvInputStreamRecordsImpl with the given parameters. |
|
CsvInputStreamRecordsImpl(Header<T> aHeader,
InputStream aCsvInputStream)
Constructs a
CsvInputStreamRecordsImpl with the given parameters. |
|
CsvInputStreamRecordsImpl(Header<T> aHeader,
InputStream aCsvInputStream,
boolean isStrict)
Constructs a
CsvInputStreamRecordsImpl with the given parameters. |
|
CsvInputStreamRecordsImpl(Header<T> aHeader,
InputStream aCsvInputStream,
char aCsvDelimiter)
Constructs a
CsvInputStreamRecordsImpl with the given parameters. |
|
CsvInputStreamRecordsImpl(Header<T> aHeader,
InputStream aCsvInputStream,
char aCsvDelimiter,
boolean isStrict)
Constructs a
CsvInputStreamRecordsImpl with the given parameters. |
Modifier and Type | Method and Description |
---|---|
long |
getErroneousRecordCount()
The number of erroneous records which were not read by the
InputStreamRecords . |
Header<T> |
getHeader()
Retrieves the
Header property. |
boolean |
hasNext() |
Record<T> |
next() |
void |
remove() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachRemaining
public CsvInputStreamRecordsImpl(Header<T> aHeader, InputStream aCsvInputStream) throws IOException
CsvInputStreamRecordsImpl
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 CsvInputStreamRecordsImpl(Header<T> aHeader, InputStream aCsvInputStream, boolean isStrict) throws IOException
CsvInputStreamRecordsImpl
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 CsvInputStreamRecordsImpl(Header<T> aHeader, InputStream aCsvInputStream, char aCsvDelimiter) throws IOException
CsvInputStreamRecordsImpl
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 CsvInputStreamRecordsImpl(Header<T> aHeader, InputStream aCsvInputStream, char aCsvDelimiter, boolean isStrict) throws IOException
CsvInputStreamRecordsImpl
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 CsvInputStreamRecordsImpl(ColumnFactory<T> aColumnFactory, InputStream aCsvInputStream) throws IOException
CsvInputStreamRecordsImpl
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 CsvInputStreamRecordsImpl(ColumnFactory<T> aColumnFactory, InputStream aCsvInputStream, boolean isStrict) throws IOException
CsvInputStreamRecordsImpl
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 CsvInputStreamRecordsImpl(ColumnFactory<T> aColumnFactory, InputStream aCsvInputStream, char aCsvDelimiter) throws IOException
CsvInputStreamRecordsImpl
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 CsvInputStreamRecordsImpl(ColumnFactory<T> aColumnFactory, InputStream aCsvInputStream, char aCsvDelimiter, boolean isStrict) throws IOException
CsvInputStreamRecordsImpl
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
.protected CsvInputStreamRecordsImpl(Header<T> aHeader, ColumnFactory<T> aColumnFactory, InputStream aCsvInputStream, char aCsvDelimiter, boolean isStrict) throws IOException
CsvInputStreamRecordsImpl
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.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> getHeader()
Header
property.getHeader
in interface HeaderAccessor<T>
Header
being stored by this property.public long getErroneousRecordCount()
InputStreamRecords
.getErroneousRecordCount
in interface InputStreamRecords<T>
Copyright © 2015. All rights reserved.