Top Description Fields Constructors Methods
com.opencsv

public Class CSVReaderHeaderAwareBuilder

extends CSVReaderBaseBuilder<CSVReaderHeaderAware>
Class Inheritance
Imports
com.opencsv.enums.CSVReaderNullFieldIndicator, com.opencsv.processor.RowProcessor, com.opencsv.validators.LineValidator, .RowValidator, org.apache.commons.lang3.ObjectUtils, java.io.IOException, .Reader, java.util.Locale, .ResourceBundle

Builder for CSVReaderHeaderAware.
Author
Andre Rosot
Since
4.2

Field Summary

Inherited from com.opencsv.CSVReaderBaseBuilder:
errorLocaleicsvParserkeepCRlineValidatorAggregatormultilineLimitnullFieldIndicatorreaderrowProcessorrowValidatorAggregatorskipLinesverifyReader

Constructor Summary

AccessConstructor and Description
public
CSVReaderHeaderAwareBuilder(Reader
The reader to an underlying CSV source.
reader
)

Sets the reader to an underlying CSV source.

Method Summary

Modifier and TypeMethod and Description
public CSVReaderHeaderAware

Returns:

The CSVReaderHeaderAware based on the set criteria.
build
()

Implements abstract com.opencsv.CSVReaderBaseBuilder.build.

Creates the CSVReaderHeaderAware.

public CSVReaderHeaderAwareBuilder

Returns:

this
withCSVParser
(final ICSVParser
The parser to use to parse the input.
icsvParser
)

Sets the parser to use to parse the input.

public CSVReaderHeaderAwareBuilder

Returns:

this
withErrorLocale
(Locale
Locale for error messages
errorLocale
)

Sets the locale for all error messages.

public CSVReaderHeaderAwareBuilder

Returns:

this
withFieldAsNull
(CSVReaderNullFieldIndicator
CSVReaderNullFieldIndicator set to what should be considered a null field.
indicator
)

Checks to see if it should treat a field with two separators, two quotes, or both as a null field.

public CSVReaderHeaderAwareBuilder

Returns:

this
withKeepCarriageReturn
(boolean
True to keep carriage returns, false to discard.
keepCR
)

Sets if the reader will keep or discard carriage returns.

public CSVReaderHeaderAwareBuilder

Returns:

this
withLineValidator
(LineValidator
LineValidator to inject.
lineValidator
)

Adds a LineValidator to the CSVReaderHeaderAware.

public CSVReaderHeaderAwareBuilder

Returns:

this
withMultilineLimit
(int
No more than this number of lines is allowed in a single input record. The default is CSVReader#DEFAULT_MULTILINE_LIMIT.
multilineLimit
)

Sets the maximum number of lines allowed in a multiline record.

public CSVReaderHeaderAwareBuilder

Returns:

this
withRowProcessor
(RowProcessor
RowProcessor to inject
rowProcessor
)

Adds a RowProcessor to the CSVReaderHeaderAware.

public CSVReaderHeaderAwareBuilder

Returns:

this
withRowValidator
(RowValidator
RowValidator to inject
rowValidator
)

Adds a RowValidator to the CSVReaderHeaderAware.

public CSVReaderHeaderAwareBuilder

Returns:

this
withSkipLines
(final int
The number of lines to skip before reading.
skipLines
)

Sets the number of lines to skip before reading.

public CSVReaderHeaderAwareBuilder

Returns:

this
withVerifyReader
(boolean
True if CSVReaderHeaderAware should verify reader before each read, false otherwise.
verifyReader
)

Checks to see if the CSVReaderHeaderAware should verify the reader state before reads or not.

Inherited from com.opencsv.CSVReaderBaseBuilder:
getCsvParsergetErrorLocalegetLineValidatorAggregatorgetMultilineLimitgetOrCreateCsvParsergetReadergetRowValidatorAggregatorgetSkipLinesisVerifyReaderkeepCarriageReturn

Constructor Detail

CSVReaderHeaderAwareBuilderback to summary
public CSVReaderHeaderAwareBuilder(Reader reader)

Sets the reader to an underlying CSV source.

Parameters
reader:Reader

The reader to an underlying CSV source.

Method Detail

buildback to summary
public CSVReaderHeaderAware build() throws RuntimeException

Implements abstract com.opencsv.CSVReaderBaseBuilder.build.

Creates the CSVReaderHeaderAware.

Returns:CSVReaderHeaderAware

The CSVReaderHeaderAware based on the set criteria.

Annotations
@Override
Exceptions
RuntimeException:
If the header mapping cannot be initialized from the first line of data
withCSVParserback to summary
public CSVReaderHeaderAwareBuilder withCSVParser(final ICSVParser icsvParser)

Sets the parser to use to parse the input.

Parameters
icsvParser:ICSVParser

The parser to use to parse the input.

Returns:CSVReaderHeaderAwareBuilder

this

withErrorLocaleback to summary
public CSVReaderHeaderAwareBuilder withErrorLocale(Locale errorLocale)

Sets the locale for all error messages.

Parameters
errorLocale:Locale

Locale for error messages

Returns:CSVReaderHeaderAwareBuilder

this

Since
4.0
withFieldAsNullback to summary
public CSVReaderHeaderAwareBuilder withFieldAsNull(CSVReaderNullFieldIndicator indicator)

Checks to see if it should treat a field with two separators, two quotes, or both as a null field.

Parameters
indicator:CSVReaderNullFieldIndicator

CSVReaderNullFieldIndicator set to what should be considered a null field.

Returns:CSVReaderHeaderAwareBuilder

this

withKeepCarriageReturnback to summary
public CSVReaderHeaderAwareBuilder withKeepCarriageReturn(boolean keepCR)

Sets if the reader will keep or discard carriage returns.

Parameters
keepCR:boolean

True to keep carriage returns, false to discard.

Returns:CSVReaderHeaderAwareBuilder

this

withLineValidatorback to summary
public CSVReaderHeaderAwareBuilder withLineValidator(LineValidator lineValidator)

Adds a LineValidator to the CSVReaderHeaderAware. Multiple LineValidators can be added with multiple calls.

Parameters
lineValidator:LineValidator

LineValidator to inject.

Returns:CSVReaderHeaderAwareBuilder

this

Since
5.0
withMultilineLimitback to summary
public CSVReaderHeaderAwareBuilder withMultilineLimit(int multilineLimit)

Sets the maximum number of lines allowed in a multiline record. More than this number in one record results in an IOException.

Parameters
multilineLimit:int

No more than this number of lines is allowed in a single input record. The default is CSVReader#DEFAULT_MULTILINE_LIMIT.

Returns:CSVReaderHeaderAwareBuilder

this

withRowProcessorback to summary
public CSVReaderHeaderAwareBuilder withRowProcessor(RowProcessor rowProcessor)

Adds a RowProcessor to the CSVReaderHeaderAware. Only a single RowProcessor can be added so multiple calls will overwrite the previously set RowProcessor.

Parameters
rowProcessor:RowProcessor

RowProcessor to inject

Returns:CSVReaderHeaderAwareBuilder

this

Since
5.0
withRowValidatorback to summary
public CSVReaderHeaderAwareBuilder withRowValidator(RowValidator rowValidator)

Adds a RowValidator to the CSVReaderHeaderAware. Multiple RowValidators can be added with multiple calls.

Parameters
rowValidator:RowValidator

RowValidator to inject

Returns:CSVReaderHeaderAwareBuilder

this

Since
5.0
withSkipLinesback to summary
public CSVReaderHeaderAwareBuilder withSkipLines(final int skipLines)

Sets the number of lines to skip before reading.

Parameters
skipLines:int

The number of lines to skip before reading.

Returns:CSVReaderHeaderAwareBuilder

this

withVerifyReaderback to summary
public CSVReaderHeaderAwareBuilder withVerifyReader(boolean verifyReader)

Checks to see if the 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.

Parameters
verifyReader:boolean

True if CSVReaderHeaderAware should verify reader before each read, false otherwise.

Returns:CSVReaderHeaderAwareBuilder

this