CsvWriter)
In addition to the configuration options provided by CommonWriterSettings, the CsvWriterSettings include:
If the writer has an empty String to write to the output, the emptyValue is used instead of an empty string
If this property is set to true, this indicates that all written values should be enclosed within quotes (as defined in CsvFormat)
com.univocity.parsers.csv.CsvWriter , com.univocity.parsers.csv.CsvFormat , com.univocity.parsers.common.CommonWriterSettings
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private boolean | |
| private boolean | |
| private char[] | |
| private boolean | |
| private FieldSelector | |
| private boolean | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected void | |
| public final CsvWriterSettings | clone()
Overrides com. |
| public final CsvWriterSettings | clone(boolean
flag indicating whether to clear settings that are likely to be associated with a given input. clearInputSpecificSettings)Overrides com. |
| protected CsvFormat | Returns: and instance of CsvFormat configured to produce CSV outputs compliant to the RFC4180 standard.Implements abstract com. |
| public char[] | Returns: the characters that will trigger values to be quoted when present in a value to be written.Returns the list of characters that when present in a value to be written, will force the output value to be enclosed in quotes. |
| public boolean | Returns: true if all written values should be enclosed within quotes, false otherwiseIndicates that all written values should be enclosed within quotes (as defined in (Defaults to false) |
| pack-priv final FieldSelector | Returns: the current selection of quoted fieldsReturns the current selection of quoted fields (if any) |
| public boolean | Returns: a flag indicating whethernull values should be quoted.Flag whether to quote |
| public boolean | Returns: true if escape sequences should be processed in unquoted values, otherwise falseIndicates whether escape sequences should be written in unquoted values. |
| public final boolean | Returns: a flag indicating whether the escape sequences should not be introduced by the writer.Indicates that the user will provide escaped input, and the writer will not try to introduce escape sequences. |
| public boolean | Returns: true if line separator characters in quoted values should be considered 'normalized' and replaced by the
sequence specified in Format#getLineSeparator(), false otherwiseFlag indicating whether the writer should replace the the normalized line separator character specified in |
| public boolean | Returns: true if the given character is a quotation trigger, false otherwise.the character to be tested ch)Queries if a given character is a quotation trigger, i.e. a character that if present in a value to be written, will make the CSV writer enclose the entire value within quotes. |
| public boolean | Returns: a flag indicating whether values containing quotes should be enclosed in quotes.Indicates whether the CSV writer should escape values that contain the quote character, by enclosing the entire value in quotes. |
| public final FieldSet | Returns: the (modifiable) set of selected fields to be quoted.a selection of columns that will always be quoted columns)Selects fields whose values should always be written within quotes |
| public final FieldSet | Returns: the (modifiable) set of selected fields to be quoted.a selection of columns that will always be quoted columns)Selects fields whose values should always be written within quotes |
| public final FieldSet | Returns: the (modifiable) set of column positions to be quoted.a selection of column indexes that will always be quoted columns)Selects field positions whose values should always be written within quotes |
| public void | setEscapeUnquotedValues(boolean
a flag indicating whether escape sequences should be processed in unquoted values escapeUnquotedValues)Configures the writer to process escape sequences in unquoted values. |
| private <T> FieldSet | Returns: the set of selected fields given in as a parameter.the new set of selected fields fieldSet, T... the values to include to the selection values)Hides com. |
| public final void | setInputEscaped(boolean
a flag indicating whether the input that will be written is already properly escaped. isInputEscaped)Configures the writer to prevent it to introduce escape sequences. |
| public void | setNormalizeLineEndingsWithinQuotes(boolean
flag indicating that line separator characters in quoted values should be
considered 'normalized' and occurrences of normalizeLineEndingsWithinQuotes)Format#getNormalizedNewline()
should be replaced by the sequence specified in Format#getLineSeparator()Flag indicating whether the writer should replace the the normalized line separator character specified in |
| public void | setQuotationTriggers(char...
a list of characters that when present in a value to be written, will
force the output value to be enclosed in quotes. quotationTriggers)Defines one or more "triggers" for enclosing a value within quotes. |
| public void | setQuoteAllFields(boolean
a flag indicating whether to enclose all fields within quotes quoteAllFields)Indicates indicates whether or not all written values should be enclosed within quotes (as defined in (Defaults to false) By default, only values that contain a field separator are enclosed within quotes. |
| public void | setQuoteEscapingEnabled(boolean
a flag indicating whether values containing quotes should be enclosed in quotes. quoteEscapingEnabled)Configures the CSV writer to escape values that contain the quote character, by enclosing the entire value in quotes. |
| public void | setQuoteNulls(boolean
flag indicating whether quoteNulls)null values should be quoted.Configures whether to quote |
| escapeUnquotedValues | back to summary |
|---|---|
| private boolean escapeUnquotedValues | |
| isInputEscaped | back to summary |
|---|---|
| private boolean isInputEscaped | |
| normalizeLineEndingsWithinQuotes | back to summary |
|---|---|
| private boolean normalizeLineEndingsWithinQuotes | |
| quotationTriggers | back to summary |
|---|---|
| private char[] quotationTriggers | |
| quoteAllFields | back to summary |
|---|---|
| private boolean quoteAllFields | |
| quotedFieldSelector | back to summary |
|---|---|
| private FieldSelector quotedFieldSelector | |
| quoteEscapingEnabled | back to summary |
|---|---|
| private boolean quoteEscapingEnabled | |
| quoteNulls | back to summary |
|---|---|
| private boolean quoteNulls | |
| CsvWriterSettings | back to summary |
|---|---|
| public CsvWriterSettings() | |
| addConfiguration | back to summary |
|---|---|
| protected void addConfiguration(Map<String, Object> out) Overrides com.
| |
| clone | back to summary |
|---|---|
| public final CsvWriterSettings clone() Overrides com. Doc from com. Clones this configuration object. Use alternative
| |
| clone | back to summary |
|---|---|
| public final CsvWriterSettings clone(boolean clearInputSpecificSettings) Overrides com. Doc from com. 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
| |
| createDefaultFormat | back to summary |
|---|---|
| protected CsvFormat createDefaultFormat() Implements abstract com. Returns the default CsvFormat configured to produce CSV outputs compliant to the RFC4180 standard. | |
| getQuotationTriggers | back to summary |
|---|---|
| public char[] getQuotationTriggers() Returns the list of characters that when present in a value to be written, will force the output value to be enclosed in quotes.
| |
| getQuoteAllFields | back to summary |
|---|---|
| public boolean getQuoteAllFields() Indicates that all written values should be enclosed within quotes (as defined in (Defaults to false)
| |
| getQuotedFieldSelector | back to summary |
|---|---|
| pack-priv final FieldSelector getQuotedFieldSelector() Returns the current selection of quoted fields (if any)
| |
| getQuoteNulls | back to summary |
|---|---|
| public boolean getQuoteNulls() Flag whether to quote
| |
| isEscapeUnquotedValues | back to summary |
|---|---|
| public boolean isEscapeUnquotedValues() Indicates whether escape sequences should be written in unquoted values. Defaults to By default, this is disabled and if the input is
| |
| isInputEscaped | back to summary |
|---|---|
| public final boolean isInputEscaped() Indicates that the user will provide escaped input, and the writer will not try to introduce escape sequences. The input will be written as-is. Warning ensure your data is properly escaped, otherwise the writer will produce invalid CSV. This is disabled by default
| |
| isNormalizeLineEndingsWithinQuotes | back to summary |
|---|---|
| public boolean isNormalizeLineEndingsWithinQuotes() Flag indicating whether the writer should replace the the normalized line separator character specified in
| |
| isQuotationTrigger | back to summary |
|---|---|
| public boolean isQuotationTrigger(char ch) Queries if a given character is a quotation trigger, i.e. a character that if present in a value to be written, will make the CSV writer enclose the entire value within quotes.
| |
| isQuoteEscapingEnabled | back to summary |
|---|---|
| public boolean isQuoteEscapingEnabled() Indicates whether the CSV writer should escape values that contain the quote character, by enclosing the entire
value in quotes.
For example, consider a value such as
| |
| quoteFields | back to summary |
|---|---|
| public final FieldSet Selects fields whose values should always be written within quotes | |
| quoteFields | back to summary |
|---|---|
| public final FieldSet Selects fields whose values should always be written within quotes | |
| quoteIndexes | back to summary |
|---|---|
| public final FieldSet Selects field positions whose values should always be written within quotes | |
| setEscapeUnquotedValues | back to summary |
|---|---|
| public void setEscapeUnquotedValues(boolean escapeUnquotedValues) Configures the writer to process escape sequences in unquoted values. Defaults to By default, this is disabled and if the input is
| |
| setFieldSet | back to summary |
|---|---|
| private <T> FieldSet Hides com. Replaces the current quoted field selection | |
| setInputEscaped | back to summary |
|---|---|
| public final void setInputEscaped(boolean isInputEscaped) Configures the writer to prevent it to introduce escape sequences. The writer will assume the user is providing escaped input, and it will be written as-is. Warning ensure your data is properly escaped, otherwise the writer will produce invalid CSV. This is disabled by default
| |
| setNormalizeLineEndingsWithinQuotes | back to summary |
|---|---|
| public void setNormalizeLineEndingsWithinQuotes(boolean normalizeLineEndingsWithinQuotes) Flag indicating whether the writer should replace the the normalized line separator character specified in
| |
| setQuotationTriggers | back to summary |
|---|---|
| public void setQuotationTriggers(char... quotationTriggers) Defines one or more "triggers" for enclosing a value within quotes. If one of the characters in the quotation trigger list is found in a value to be written, the entire value will be enclosed in quotes.
| |
| setQuoteAllFields | back to summary |
|---|---|
| public void setQuoteAllFields(boolean quoteAllFields) Indicates indicates whether or not all written values should be enclosed within quotes (as defined in (Defaults to false) By default, only values that contain a field separator are enclosed within quotes.
| |
| setQuoteEscapingEnabled | back to summary |
|---|---|
| public void setQuoteEscapingEnabled(boolean quoteEscapingEnabled) Configures the CSV writer to escape values that contain the quote character, by enclosing the entire
value in quotes.
For example, consider a value such as
| |
| setQuoteNulls | back to summary |
|---|---|
| public void setQuoteNulls(boolean quoteNulls) Configures whether to quote
| |