public class CSVReaderHeaderAwareBuilder extends CSVReaderBaseBuilder<CSVReaderHeaderAware>
CSVReaderHeaderAware
.errorLocale, icsvParser, keepCR, lineValidatorAggregator, multilineLimit, nullFieldIndicator, reader, rowProcessor, rowValidatorAggregator, skipLines, verifyReader
Constructor and Description |
---|
CSVReaderHeaderAwareBuilder(Reader reader)
Sets the reader to an underlying CSV source.
|
Modifier and Type | Method and Description |
---|---|
CSVReaderHeaderAware |
build()
Creates the
CSVReaderHeaderAware . |
CSVReaderHeaderAwareBuilder |
withCSVParser(ICSVParser icsvParser)
Sets the parser to use to parse the input.
|
CSVReaderHeaderAwareBuilder |
withErrorLocale(Locale errorLocale)
Sets the locale for all error messages.
|
CSVReaderHeaderAwareBuilder |
withFieldAsNull(CSVReaderNullFieldIndicator indicator)
Checks to see if it should treat a field with two separators, two quotes, or both as a null field.
|
CSVReaderHeaderAwareBuilder |
withKeepCarriageReturn(boolean keepCR)
Sets if the reader will keep or discard carriage returns.
|
CSVReaderHeaderAwareBuilder |
withLineValidator(LineValidator lineValidator)
Adds a
LineValidator to the CSVReaderHeaderAware . |
CSVReaderHeaderAwareBuilder |
withMultilineLimit(int multilineLimit)
Sets the maximum number of lines allowed in a multiline record.
|
CSVReaderHeaderAwareBuilder |
withRowProcessor(RowProcessor rowProcessor)
Adds a
RowProcessor to the CSVReaderHeaderAware . |
CSVReaderHeaderAwareBuilder |
withRowValidator(RowValidator rowValidator)
Adds a
RowValidator to the CSVReaderHeaderAware . |
CSVReaderHeaderAwareBuilder |
withSkipLines(int skipLines)
Sets the number of lines to skip before reading.
|
CSVReaderHeaderAwareBuilder |
withVerifyReader(boolean verifyReader)
Checks to see if the
CSVReaderHeaderAware should verify the reader state before
reads or not. |
getCsvParser, getErrorLocale, getLineValidatorAggregator, getMultilineLimit, getOrCreateCsvParser, getReader, getRowValidatorAggregator, getSkipLines, isVerifyReader, keepCarriageReturn
public CSVReaderHeaderAwareBuilder(Reader reader)
reader
- The reader to an underlying CSV source.public CSVReaderHeaderAwareBuilder withSkipLines(int skipLines)
skipLines
- The number of lines to skip before reading.this
public CSVReaderHeaderAwareBuilder withCSVParser(ICSVParser icsvParser)
icsvParser
- The parser to use to parse the input.this
public CSVReaderHeaderAwareBuilder withKeepCarriageReturn(boolean keepCR)
keepCR
- True to keep carriage returns, false to discard.this
public CSVReaderHeaderAwareBuilder withVerifyReader(boolean verifyReader)
CSVReaderHeaderAware
should verify the reader state before
reads or not.
This should be set to false if you are using some form of asynchronous reader (like readers created by the java.nio.* classes).
The default value is true.
verifyReader
- True if CSVReaderHeaderAware
should verify reader before each read, false otherwise.this
public CSVReaderHeaderAwareBuilder withFieldAsNull(CSVReaderNullFieldIndicator indicator)
indicator
- CSVReaderNullFieldIndicator
set to what should be considered a null field.this
public CSVReaderHeaderAwareBuilder withMultilineLimit(int multilineLimit)
multilineLimit
- No more than this number of lines is allowed in a
single input record. The default is CSVReader.DEFAULT_MULTILINE_LIMIT
.this
public CSVReaderHeaderAwareBuilder withErrorLocale(Locale errorLocale)
errorLocale
- Locale for error messagesthis
public CSVReaderHeaderAwareBuilder withLineValidator(LineValidator lineValidator)
LineValidator
to the CSVReaderHeaderAware
.
Multiple LineValidator
s can be added with multiple calls.lineValidator
- LineValidator
to inject.this
public CSVReaderHeaderAwareBuilder withRowValidator(RowValidator rowValidator)
RowValidator
to the CSVReaderHeaderAware
.
Multiple RowValidator
s can be added with multiple calls.rowValidator
- RowValidator
to injectthis
public CSVReaderHeaderAwareBuilder withRowProcessor(RowProcessor rowProcessor)
RowProcessor
to the CSVReaderHeaderAware
.
Only a single RowProcessor
can be added so multiple calls will overwrite
the previously set RowProcessor
.rowProcessor
- RowProcessor
to injectthis
public CSVReaderHeaderAware build() throws RuntimeException
CSVReaderHeaderAware
.build
in class CSVReaderBaseBuilder<CSVReaderHeaderAware>
CSVReaderHeaderAware
based on the set criteria.RuntimeException
- If the header mapping cannot be initialized
from the first line of dataCopyright © 2005–2023. All rights reserved.