Top Description Fields Constructors Methods
com.univocity.parsers.csv

public Class CsvParserSettings

extends CommonParserSettings<CsvFormat>
Class Inheritance
Imports
com.univocity.parsers.common.*, com.univocity.parsers.common.input.*, java.util.*

This is the configuration class used by the CSV parser (CsvParser)

In addition to the configuration options provided by CommonParserSettings, the CSVParserSettings include:

Author
Univocity Software Pty Ltd - [email protected]
See Also
com.univocity.parsers.csv.CsvParser, com.univocity.parsers.csv.CsvFormat, com.univocity.parsers.common.CommonParserSettings

Field Summary

Modifier and TypeField and Description
private boolean
private char[]
private String
private boolean
private int
private boolean
private boolean
private boolean
private boolean
private boolean
private boolean
private boolean
private boolean
private UnescapedQuoteHandling
Inherited from com.univocity.parsers.common.CommonParserSettings:
headerExtractionEnabled

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
public final CsvParserSettings
clone()

Overrides com.univocity.parsers.common.CommonParserSettings.clone.

Clones this configuration object.
public final CsvParserSettings
clone(boolean
flag indicating whether to clear settings that are likely to be associated with a given input.
clearInputSpecificSettings
)

Overrides com.univocity.parsers.common.CommonParserSettings.clone.

Clones this configuration object to reuse user-provided settings.
protected CsvFormat

Returns:

and instance of CsvFormat configured to handle CSV inputs compliant to the RFC4180 standard.
createDefaultFormat
()

Implements abstract com.univocity.parsers.common.CommonSettings.createDefaultFormat.

Returns the default CsvFormat configured to handle CSV inputs compliant to the RFC4180 standard.
public final void
detectFormatAutomatically()

Convenience method to turn on all format detection features in a single method call, namely:

public final void
detectFormatAutomatically(char...
possible delimiters for detection, in order of priority.
delimitersForDetection
)

Convenience method to turn on all format detection features in a single method call, namely:

public final char[]

Returns:

the possible delimiter characters, in order of priority.
getDelimitersForDetection
()

Returns the sequence of possible delimiters for detection when isDelimiterDetectionEnabled() evaluates to true, in order of priority.

public String

Returns:

the String representation of an empty value
getEmptyValue
()

Returns the String representation of an empty value (defaults to null)

When reading, if the parser does not read any character from the input, and the input is within quotes, the empty is used instead of an empty string

public int

Returns:

the number of sample rows used in the CSV format auto-detection process
getFormatDetectorRowSampleCount
()

Returns the number of sample rows used in the CSV format auto-detection process (defaults to 20)

public boolean

Returns:

true if leading whitespaces from quoted values should be skipped, false otherwise
getIgnoreLeadingWhitespacesInQuotes
()

Returns whether or not leading whitespaces from quoted values should be skipped (defaults to false) Note: if keepQuotes evaluates to true, values won't be trimmed.

public boolean

Returns:

true if trailing whitespaces from quoted values should be skipped, false otherwise
getIgnoreTrailingWhitespacesInQuotes
()

Returns whether or not trailing whitespaces from within quoted values should be skipped (defaults to false) Note: if keepQuotes evaluates to true, values won't be trimmed.

public boolean

Returns:

a flag indicating whether enclosing quotes should be maintained when parsing quoted values.
getKeepQuotes
()

Flag indicating whether the parser should keep enclosing quote characters in the values parsed from the input.

public UnescapedQuoteHandling

Returns:

the handling method to be used when unescaped quotes are found in the input, or null if not set.
getUnescapedQuoteHandling
()

Returns the method of handling values with unescaped quotes.

public final boolean

Returns:

a flag indicating whether the parser should analyze the input to discover the column delimiter character.
isDelimiterDetectionEnabled
()

Returns a flag indicating whether the parser should analyze the input to discover the column delimiter character.

public boolean

Returns:

true if escape sequences should be processed in unquoted values, otherwise false
isEscapeUnquotedValues
()

Indicates whether escape sequences should be processed in unquoted values.

public final boolean

Returns:

a flag indicating whether escape sequences should be kept (and not replaced) by the parser.
isKeepEscapeSequences
()

Indicates whether the parser should keep any escape sequences if they are present in the input (i.e. a quote escape sequence such as two double quotes "" won't be replaced by a single double quote ").

public boolean

Returns:

true if line separators in quoted values will be normalized, false otherwise
isNormalizeLineEndingsWithinQuotes
()

Flag indicating whether the parser should replace line separators, specified in Format#getLineSeparator() by the normalized line separator character specified in Format#getNormalizedNewline(), even on quoted values.

public boolean

Returns:

a flag indicating whether or not the CSV parser should accept unescaped quotes inside quoted values.
isParseUnescapedQuotes
()

Deprecated use getUnescapedQuoteHandling() instead.
Indicates whether the CSV parser should accept unescaped quotes inside quoted values and parse them normally.
public boolean

Returns:

a flag indicating that the parser should stop accumulating values when a field delimiter character is found when parsing unquoted and unescaped values.
isParseUnescapedQuotesUntilDelimiter
()

Deprecated use getUnescapedQuoteHandling() instead.
When parsing unescaped quotes, indicates the parser should stop accumulating characters and consider the value parsed when a delimiter is found.
public final boolean

Returns:

a flag indicating whether the parser should analyze the input to discover the quote character. The quote escape will also be detected as part of this process.
isQuoteDetectionEnabled
()

Returns a flag indicating whether the parser should analyze the input to discover the quote character.

protected CharAppender

Returns:

an instance of CharAppender with the configured limit of maximum characters per column and the default value used to represent an empty value (when the String parsed from the input, within quotes, is empty)
newCharAppender
()

Overrides com.univocity.parsers.common.CommonParserSettings.newCharAppender.

Returns an instance of CharAppender with the configured limit of maximum characters per column and the default value used to represent an empty value (when the String parsed from the input, within quotes, is empty)

This overrides the parent's version because the CSV parser does not rely on the appender to identify null values, but on the other hand, the appender is required to identify empty values.

public final void
setDelimiterDetectionEnabled(boolean
the flag to enable/disable discovery of the column delimiter character. to true, in order of priority.
separatorDetectionEnabled
)

Configures the parser to analyze the input before parsing to discover the column delimiter character.

public final void
setDelimiterDetectionEnabled(boolean
the flag to enable/disable discovery of the column delimiter character.
separatorDetectionEnabled
,
char...
possible delimiters for detection when isDelimiterDetectionEnabled() evaluates to true, in order of priority.
delimitersForDetection
)

Configures the parser to analyze the input before parsing to discover the column delimiter character.

public void
setEmptyValue(String
the String representation of an empty value
emptyValue
)

Sets the String representation of an empty value (defaults to null)

When reading, if the parser does not read any character from the input, and the input is within quotes, the empty is used instead of an empty string

public void
setEscapeUnquotedValues(boolean
a flag indicating whether escape sequences should be processed in unquoted values
escapeUnquotedValues
)

Configures the parser to process escape sequences in unquoted values.

public void
setFormatDetectorRowSampleCount(int
the number of sample rows used in the CSV format auto-detection process
formatDetectorRowSampleCount
)

Updates the number of sample rows used in the CSV format auto-detection process (defaults to 20)

public void
setIgnoreLeadingWhitespacesInQuotes(boolean
whether leading whitespaces from quoted values should be skipped
ignoreLeadingWhitespacesInQuotes
)

Defines whether or not leading whitespaces from quoted values should be skipped (defaults to false) Note: if keepQuotes evaluates to true, values won't be trimmed.

public void
setIgnoreTrailingWhitespacesInQuotes(boolean
whether trailing whitespaces from quoted values should be skipped
ignoreTrailingWhitespacesInQuotes
)

Defines whether or not trailing whitespaces from quoted values should be skipped (defaults to false) Note: if keepQuotes evaluates to true, values won't be trimmed.

public final void
setKeepEscapeSequences(boolean
the flag indicating whether escape sequences should be kept (and not replaced) by the parser.
keepEscapeSequences
)

Configures the parser to keep any escape sequences if they are present in the input (i.e. a quote escape sequence such as 2 double quotes "" won't be replaced by a single double quote ").

public void
setKeepQuotes(boolean
flag indicating whether enclosing quotes should be maintained when parsing quoted values.
keepQuotes
)

Configures the parser to keep enclosing quote characters in the values parsed from the input.

public void
setNormalizeLineEndingsWithinQuotes(boolean
flag indicating whether line separators in quoted values should be replaced by the the character specified in Format#getNormalizedNewline() .
normalizeLineEndingsWithinQuotes
)

Configures the parser to replace line separators, specified in Format#getLineSeparator() by the normalized line separator character specified in Format#getNormalizedNewline(), even on quoted values.

public void
setParseUnescapedQuotes(boolean
indicates whether or not the CSV parser should accept unescaped quotes inside quoted values.
parseUnescapedQuotes
)

Configures how to handle unescaped quotes inside quoted values.
public void
setParseUnescapedQuotesUntilDelimiter(boolean
a flag indicating that the parser should stop accumulating values when a field delimiter character is found when parsing unquoted and unescaped values.
parseUnescapedQuotesUntilDelimiter
)

Configures the parser to process values with unescaped quotes, and stop accumulating characters and consider the value parsed when a delimiter is found.
public final void
setQuoteDetectionEnabled(boolean
the flag to enable/disable discovery of the quote character. The quote escape will also be detected as part of this process.
quoteDetectionEnabled
)

Configures the parser to analyze the input before parsing to discover the quote character.

public void
setUnescapedQuoteHandling(UnescapedQuoteHandling
the handling method to be used when unescaped quotes are found in the input.
unescapedQuoteHandling
)

Configures the handling of values with unescaped quotes.

public final void
trimQuotedValues(boolean
a flag indicating whether whitespaces around values extracted from a quoted field should be removed
trim
)

Configures the parser to trim any whitespaces around values extracted from within quotes.

Inherited from com.univocity.parsers.common.CommonParserSettings:
addInputAnalysisProcessclearInputSpecificSettingsconfigureFromAnnotationsgetInputAnalysisProcessesgetInputBufferSizegetNumberOfRecordsToReadgetNumberOfRowsToSkipgetProcessorgetReadInputOnSeparateThreadgetRowProcessorisAutoClosingEnabledisColumnReorderingEnabledisCommentCollectionEnabledisCommentProcessingEnabledisHeaderExtractionEnabledisLineSeparatorDetectionEnablednewCharInputReadersetAutoClosingEnabledsetColumnReorderingEnabledsetCommentCollectionEnabledsetCommentProcessingEnabledsetHeaderExtractionEnabledsetInputBufferSizesetLineSeparatorDetectionEnabledsetNumberOfRecordsToReadsetNumberOfRowsToSkipsetProcessorsetReadInputOnSeparateThreadsetRowProcessor

Field Detail

delimiterDetectionEnabledback to summary
private boolean delimiterDetectionEnabled
delimitersForDetectionback to summary
private char[] delimitersForDetection
emptyValueback to summary
private String emptyValue
escapeUnquotedValuesback to summary
private boolean escapeUnquotedValues
formatDetectorRowSampleCountback to summary
private int formatDetectorRowSampleCount
ignoreLeadingWhitespacesInQuotesback to summary
private boolean ignoreLeadingWhitespacesInQuotes
ignoreTrailingWhitespacesInQuotesback to summary
private boolean ignoreTrailingWhitespacesInQuotes
keepEscapeSequencesback to summary
private boolean keepEscapeSequences
keepQuotesback to summary
private boolean keepQuotes
normalizeLineEndingsWithinQuotesback to summary
private boolean normalizeLineEndingsWithinQuotes
parseUnescapedQuotesback to summary
private boolean parseUnescapedQuotes
parseUnescapedQuotesUntilDelimiterback to summary
private boolean parseUnescapedQuotesUntilDelimiter
quoteDetectionEnabledback to summary
private boolean quoteDetectionEnabled
unescapedQuoteHandlingback to summary
private UnescapedQuoteHandling unescapedQuoteHandling

Constructor Detail

CsvParserSettingsback to summary
public CsvParserSettings()

Method Detail

addConfigurationback to summary
protected void addConfiguration(Map<String, Object> out)

Overrides com.univocity.parsers.common.CommonParserSettings.addConfiguration.

Annotations
@Override
cloneback to summary
public final CsvParserSettings clone()

Overrides com.univocity.parsers.common.CommonParserSettings.clone.

Doc from com.univocity.parsers.common.CommonSettings.clone.

Clones this configuration object. Use alternative clone(boolean) method to reset properties that are specific to a given input, such as header names and selection of fields.

Returns:CsvParserSettings

a copy of all configurations applied to the current instance.

Annotations
@Override
cloneback to summary
public final CsvParserSettings clone(boolean clearInputSpecificSettings)

Overrides com.univocity.parsers.common.CommonParserSettings.clone.

Doc from com.univocity.parsers.common.CommonSettings.clone.

Clones this configuration object to reuse user-provided settings. Properties that are specific to a given input (such as header names and selection of fields) can be reset to their defaults if the clearInputSpecificSettings flag is set to true

Parameters
clearInputSpecificSettings:boolean

flag indicating whether to clear settings that are likely to be associated with a given input.

Returns:CsvParserSettings

a copy of the configurations applied to the current instance.

Annotations
@Override
createDefaultFormatback to summary
protected CsvFormat createDefaultFormat()

Implements abstract com.univocity.parsers.common.CommonSettings.createDefaultFormat.

Returns the default CsvFormat configured to handle CSV inputs compliant to the RFC4180 standard.

Returns:CsvFormat

and instance of CsvFormat configured to handle CSV inputs compliant to the RFC4180 standard.

Annotations
@Override
detectFormatAutomaticallyback to summary
public final void detectFormatAutomatically()

Convenience method to turn on all format detection features in a single method call, namely:

detectFormatAutomaticallyback to summary
public final void detectFormatAutomatically(char... delimitersForDetection)

Convenience method to turn on all format detection features in a single method call, namely:

Parameters
delimitersForDetection:char[]

possible delimiters for detection, in order of priority.

getDelimitersForDetectionback to summary
public final char[] getDelimitersForDetection()

Returns the sequence of possible delimiters for detection when isDelimiterDetectionEnabled() evaluates to true, in order of priority.

Returns:char[]

the possible delimiter characters, in order of priority.

getEmptyValueback to summary
public String getEmptyValue()

Returns the String representation of an empty value (defaults to null)

When reading, if the parser does not read any character from the input, and the input is within quotes, the empty is used instead of an empty string

Returns:String

the String representation of an empty value

getFormatDetectorRowSampleCountback to summary
public int getFormatDetectorRowSampleCount()

Returns the number of sample rows used in the CSV format auto-detection process (defaults to 20)

Returns:int

the number of sample rows used in the CSV format auto-detection process

getIgnoreLeadingWhitespacesInQuotesback to summary
public boolean getIgnoreLeadingWhitespacesInQuotes()

Returns whether or not leading whitespaces from quoted values should be skipped (defaults to false) Note: if keepQuotes evaluates to true, values won't be trimmed.

Returns:boolean

true if leading whitespaces from quoted values should be skipped, false otherwise

getIgnoreTrailingWhitespacesInQuotesback to summary
public boolean getIgnoreTrailingWhitespacesInQuotes()

Returns whether or not trailing whitespaces from within quoted values should be skipped (defaults to false) Note: if keepQuotes evaluates to true, values won't be trimmed.

Returns:boolean

true if trailing whitespaces from quoted values should be skipped, false otherwise

getKeepQuotesback to summary
public boolean getKeepQuotes()

Flag indicating whether the parser should keep enclosing quote characters in the values parsed from the input.

Defaults to false

Returns:boolean

a flag indicating whether enclosing quotes should be maintained when parsing quoted values.

getUnescapedQuoteHandlingback to summary
public UnescapedQuoteHandling getUnescapedQuoteHandling()

Returns the method of handling values with unescaped quotes. Defaults to null, for backward compatibility with isParseUnescapedQuotes() and isParseUnescapedQuotesUntilDelimiter() If set to a non-null value, this setting will override the configuration of isParseUnescapedQuotes() and isParseUnescapedQuotesUntilDelimiter().

Returns:UnescapedQuoteHandling

the handling method to be used when unescaped quotes are found in the input, or null if not set.

isDelimiterDetectionEnabledback to summary
public final boolean isDelimiterDetectionEnabled()

Returns a flag indicating whether the parser should analyze the input to discover the column delimiter character.

Note that the detection process is not guaranteed to discover the correct column delimiter. In this case the delimiter provided by CsvFormat#getDelimiter() will be used

Returns:boolean

a flag indicating whether the parser should analyze the input to discover the column delimiter character.

isEscapeUnquotedValuesback to summary
public boolean isEscapeUnquotedValues()

Indicates whether escape sequences should be processed in unquoted values. Defaults to false.

By default, this is disabled and if the input is A""B,C, the resulting value will be [A""B] and [C] (i.e. the content is read as-is). However, if the parser is configured to process escape sequences in unquoted values, the result will be [A"B] and [C]

Returns:boolean

true if escape sequences should be processed in unquoted values, otherwise false

isKeepEscapeSequencesback to summary
public final boolean isKeepEscapeSequences()

Indicates whether the parser should keep any escape sequences if they are present in the input (i.e. a quote escape sequence such as two double quotes "" won't be replaced by a single double quote ").

This is disabled by default

Returns:boolean

a flag indicating whether escape sequences should be kept (and not replaced) by the parser.

isNormalizeLineEndingsWithinQuotesback to summary
public boolean isNormalizeLineEndingsWithinQuotes()

Flag indicating whether the parser should replace line separators, specified in Format#getLineSeparator() by the normalized line separator character specified in Format#getNormalizedNewline(), even on quoted values. This is enabled by default and is used to ensure data be read on any platform without introducing unwanted blank lines. For example, consider the quoted value "Line1 \r\n Line2". If this is parsed using "\r\n" as the line separator sequence, and the normalized new line is set to '\n' (the default), the output will be: [Line1 \n Line2] However, if the value is meant to be kept untouched, and the original line separator should be maintained, set the normalizeLineEndingsWithinQuotes to false. This will make the parser read the value as-is, producing: [Line1 \r\n Line2]

Returns:boolean

true if line separators in quoted values will be normalized, false otherwise

isParseUnescapedQuotesback to summary
public boolean isParseUnescapedQuotes()

Deprecated

use getUnescapedQuoteHandling() instead. The configuration returned by getUnescapedQuoteHandling() will override this setting if not null.

Indicates whether the CSV parser should accept unescaped quotes inside quoted values and parse them normally. Defaults to true.

Returns:boolean

a flag indicating whether or not the CSV parser should accept unescaped quotes inside quoted values.

Annotations
@Deprecated
isParseUnescapedQuotesUntilDelimiterback to summary
public boolean isParseUnescapedQuotesUntilDelimiter()

Deprecated

use getUnescapedQuoteHandling() instead. The configuration returned by getUnescapedQuoteHandling() will override this setting if not null.

When parsing unescaped quotes, indicates the parser should stop accumulating characters and consider the value parsed when a delimiter is found. (defaults to true)

Returns:boolean

a flag indicating that the parser should stop accumulating values when a field delimiter character is found when parsing unquoted and unescaped values.

Annotations
@Deprecated
isQuoteDetectionEnabledback to summary
public final boolean isQuoteDetectionEnabled()

Returns a flag indicating whether the parser should analyze the input to discover the quote character. The quote escape will also be detected as part of this process.

Note that the detection process is not guaranteed to discover the correct quote & escape. In this case the characters provided by CsvFormat#getQuote() and CsvFormat#getQuoteEscape() will be used

Returns:boolean

a flag indicating whether the parser should analyze the input to discover the quote character. The quote escape will also be detected as part of this process.

newCharAppenderback to summary
protected CharAppender newCharAppender()

Overrides com.univocity.parsers.common.CommonParserSettings.newCharAppender.

Returns an instance of CharAppender with the configured limit of maximum characters per column and the default value used to represent an empty value (when the String parsed from the input, within quotes, is empty)

This overrides the parent's version because the CSV parser does not rely on the appender to identify null values, but on the other hand, the appender is required to identify empty values.

Returns:CharAppender

an instance of CharAppender with the configured limit of maximum characters per column and the default value used to represent an empty value (when the String parsed from the input, within quotes, is empty)

Annotations
@Override
setDelimiterDetectionEnabledback to summary
public final void setDelimiterDetectionEnabled(boolean separatorDetectionEnabled)

Configures the parser to analyze the input before parsing to discover the column delimiter character.

Note that the detection process is not guaranteed to discover the correct column delimiter. The first character in the list of delimiters allowed for detection will be used, if available, otherwise the delimiter returned by CsvFormat#getDelimiter() will be used.

Parameters
separatorDetectionEnabled:boolean

the flag to enable/disable discovery of the column delimiter character. to true, in order of priority.

setDelimiterDetectionEnabledback to summary
public final void setDelimiterDetectionEnabled(boolean separatorDetectionEnabled, char... delimitersForDetection)

Configures the parser to analyze the input before parsing to discover the column delimiter character.

Note that the detection process is not guaranteed to discover the correct column delimiter. The first character in the list of delimiters allowed for detection will be used, if available, otherwise the delimiter returned by CsvFormat#getDelimiter() will be used.

Parameters
separatorDetectionEnabled:boolean

the flag to enable/disable discovery of the column delimiter character.

delimitersForDetection:char[]

possible delimiters for detection when isDelimiterDetectionEnabled() evaluates to true, in order of priority.

setEmptyValueback to summary
public void setEmptyValue(String emptyValue)

Sets the String representation of an empty value (defaults to null)

When reading, if the parser does not read any character from the input, and the input is within quotes, the empty is used instead of an empty string

Parameters
emptyValue:String

the String representation of an empty value

setEscapeUnquotedValuesback to summary
public void setEscapeUnquotedValues(boolean escapeUnquotedValues)

Configures the parser to process escape sequences in unquoted values. Defaults to false.

By default, this is disabled and if the input is A""B,C, the resulting value will be [A""B] and [C] (i.e. the content is read as-is). However, if the parser is configured to process escape sequences in unquoted values, the result will be [A"B] and [C]

Parameters
escapeUnquotedValues:boolean

a flag indicating whether escape sequences should be processed in unquoted values

setFormatDetectorRowSampleCountback to summary
public void setFormatDetectorRowSampleCount(int formatDetectorRowSampleCount)

Updates the number of sample rows used in the CSV format auto-detection process (defaults to 20)

Parameters
formatDetectorRowSampleCount:int

the number of sample rows used in the CSV format auto-detection process

setIgnoreLeadingWhitespacesInQuotesback to summary
public void setIgnoreLeadingWhitespacesInQuotes(boolean ignoreLeadingWhitespacesInQuotes)

Defines whether or not leading whitespaces from quoted values should be skipped (defaults to false) Note: if keepQuotes evaluates to true, values won't be trimmed.

Parameters
ignoreLeadingWhitespacesInQuotes:boolean

whether leading whitespaces from quoted values should be skipped

setIgnoreTrailingWhitespacesInQuotesback to summary
public void setIgnoreTrailingWhitespacesInQuotes(boolean ignoreTrailingWhitespacesInQuotes)

Defines whether or not trailing whitespaces from quoted values should be skipped (defaults to false) Note: if keepQuotes evaluates to true, values won't be trimmed.

Parameters
ignoreTrailingWhitespacesInQuotes:boolean

whether trailing whitespaces from quoted values should be skipped

setKeepEscapeSequencesback to summary
public final void setKeepEscapeSequences(boolean keepEscapeSequences)

Configures the parser to keep any escape sequences if they are present in the input (i.e. a quote escape sequence such as 2 double quotes "" won't be replaced by a single double quote ").

This is disabled by default

Parameters
keepEscapeSequences:boolean

the flag indicating whether escape sequences should be kept (and not replaced) by the parser.

setKeepQuotesback to summary
public void setKeepQuotes(boolean keepQuotes)

Configures the parser to keep enclosing quote characters in the values parsed from the input.

Defaults to false

Parameters
keepQuotes:boolean

flag indicating whether enclosing quotes should be maintained when parsing quoted values.

setNormalizeLineEndingsWithinQuotesback to summary
public void setNormalizeLineEndingsWithinQuotes(boolean normalizeLineEndingsWithinQuotes)

Configures the parser to replace line separators, specified in Format#getLineSeparator() by the normalized line separator character specified in Format#getNormalizedNewline(), even on quoted values. This is enabled by default and is used to ensure data be read on any platform without introducing unwanted blank lines. For example, consider the quoted value "Line1 \r\n Line2". If this is parsed using "\r\n" as the line separator sequence, and the normalized new line is set to '\n' (the default), the output will be: [Line1 \n Line2] However, if the value is meant to be kept untouched, and the original line separator should be maintained, set the normalizeLineEndingsWithinQuotes to false. This will make the parser read the value as-is, producing: [Line1 \r\n Line2]

Parameters
normalizeLineEndingsWithinQuotes:boolean

flag indicating whether line separators in quoted values should be replaced by the the character specified in Format#getNormalizedNewline() .

setParseUnescapedQuotesback to summary
public void setParseUnescapedQuotes(boolean parseUnescapedQuotes)

Deprecated

use setUnescapedQuoteHandling(UnescapedQuoteHandling) instead. The configuration returned by getUnescapedQuoteHandling() will override this setting if not null.

Configures how to handle unescaped quotes inside quoted values. If set to true, the parser will parse the quote normally as part of the value. If set the false, a TextParsingException will be thrown. Defaults to true.

Parameters
parseUnescapedQuotes:boolean

indicates whether or not the CSV parser should accept unescaped quotes inside quoted values.

Annotations
@Deprecated
setParseUnescapedQuotesUntilDelimiterback to summary
public void setParseUnescapedQuotesUntilDelimiter(boolean parseUnescapedQuotesUntilDelimiter)

Deprecated

use setUnescapedQuoteHandling(UnescapedQuoteHandling) instead. The configuration returned by getUnescapedQuoteHandling() will override this setting if not null.

Configures the parser to process values with unescaped quotes, and stop accumulating characters and consider the value parsed when a delimiter is found. (defaults to true)

Parameters
parseUnescapedQuotesUntilDelimiter:boolean

a flag indicating that the parser should stop accumulating values when a field delimiter character is found when parsing unquoted and unescaped values.

Annotations
@Deprecated
setQuoteDetectionEnabledback to summary
public final void setQuoteDetectionEnabled(boolean quoteDetectionEnabled)

Configures the parser to analyze the input before parsing to discover the quote character. The quote escape will also be detected as part of this process.

Note that the detection process is not guaranteed to discover the correct quote & escape. In this case the characters provided by CsvFormat#getQuote() and CsvFormat#getQuoteEscape() will be used

Parameters
quoteDetectionEnabled:boolean

the flag to enable/disable discovery of the quote character. The quote escape will also be detected as part of this process.

setUnescapedQuoteHandlingback to summary
public void setUnescapedQuoteHandling(UnescapedQuoteHandling unescapedQuoteHandling)

Configures the handling of values with unescaped quotes. Defaults to null, for backward compatibility with isParseUnescapedQuotes() and isParseUnescapedQuotesUntilDelimiter(). If set to a non-null value, this setting will override the configuration of isParseUnescapedQuotes() and isParseUnescapedQuotesUntilDelimiter().

Parameters
unescapedQuoteHandling:UnescapedQuoteHandling

the handling method to be used when unescaped quotes are found in the input.

trimQuotedValuesback to summary
public final void trimQuotedValues(boolean trim)

Configures the parser to trim any whitespaces around values extracted from within quotes. Shorthand for setIgnoreLeadingWhitespacesInQuotes(boolean) and setIgnoreTrailingWhitespacesInQuotes(boolean)

Note

if keepQuotes evaluates to true, values won't be trimmed.

Parameters
trim:boolean

a flag indicating whether whitespaces around values extracted from a quoted field should be removed