Modified:
websites/production/commons/content/proper/commons-csv/jacoco/org.apache.commons.csv/CSVFormat.java.html
==============================================================================
---
websites/production/commons/content/proper/commons-csv/jacoco/org.apache.commons.csv/CSVFormat.java.html
(original)
+++
websites/production/commons/content/proper/commons-csv/jacoco/org.apache.commons.csv/CSVFormat.java.html
Mon Jan 13 14:52:07 2025
@@ -188,29 +188,44 @@ public final class CSVFormat implements
public static class Builder implements Supplier<CSVFormat> {
/**
- * Creates a new default builder.
+ * Creates a new default builder, as for {@link #RFC4180} but allowing
empty lines.
+ *
+ * <p>
+ * The {@link Builder} settings are:
+ * </p>
+ * <ul>
+ * <li>{@link Builder#setDelimiter(char) setDelimiter}{@code
(',')}</li>
+ * <li>{@link Builder#setQuote(char) setQuote}{@code
('"')}</li>
+ * <li>{@link Builder#setRecordSeparator(String)
setRecordSeparator}{@code ("\r\n")}</li>
+ * <li>{@link Builder#setIgnoreEmptyLines(boolean)
setIgnoreEmptyLines}{@code (true)}</li>
+ * <li>{@link
Builder#setDuplicateHeaderMode(DuplicateHeaderMode)
setDuplicateHeaderMode}{@code (DuplicateHeaderMode.ALLOW_ALL)}</li>
+ * <li>All other values take their Java defaults, {@code false}
for booleans, {@code null} for object references.</li>
+ * </ul>
+ *
+ * @see Predefined#Default
+ * @see DuplicateHeaderMode#ALLOW_ALL
*
* @return a copy of the builder
*/
public static Builder create() {
// @formatter:off
-<span class="fc" id="L197"> return new Builder()</span>
-<span class="fc" id="L198">
.setDelimiter(Constants.COMMA)</span>
-<span class="fc" id="L199">
.setRecordSeparator(Constants.CRLF)</span>
-<span class="fc" id="L200">
.setQuote(Constants.DOUBLE_QUOTE_CHAR)</span>
-<span class="fc" id="L201">
.setIgnoreEmptyLines(true)</span>
-<span class="fc" id="L202">
.setDuplicateHeaderMode(DuplicateHeaderMode.ALLOW_ALL);</span>
+<span class="fc" id="L212"> return new Builder()</span>
+<span class="fc" id="L213">
.setDelimiter(Constants.COMMA)</span>
+<span class="fc" id="L214">
.setQuote(Constants.DOUBLE_QUOTE_CHAR)</span>
+<span class="fc" id="L215">
.setRecordSeparator(Constants.CRLF)</span>
+<span class="fc" id="L216">
.setIgnoreEmptyLines(true)</span>
+<span class="fc" id="L217">
.setDuplicateHeaderMode(DuplicateHeaderMode.ALLOW_ALL);</span>
// @formatter:on
}
/**
- * Creates a new builder for the given format.
+ * Creates a new builder from the given format.
*
* @param csvFormat the source format.
- * @return a copy of the builder
+ * @return a new builder.
*/
public static Builder create(final CSVFormat csvFormat) {
-<span class="fc" id="L213"> return new Builder(csvFormat);</span>
+<span class="fc" id="L228"> return new Builder(csvFormat);</span>
}
private boolean allowMissingColumnNames;
@@ -259,29 +274,29 @@ public final class CSVFormat implements
// empty
}
-<span class="fc" id="L262"> private Builder(final CSVFormat csvFormat)
{</span>
-<span class="fc" id="L263"> this.delimiter =
csvFormat.delimiter;</span>
-<span class="fc" id="L264"> this.quoteCharacter =
csvFormat.quoteCharacter;</span>
-<span class="fc" id="L265"> this.quoteMode =
csvFormat.quoteMode;</span>
-<span class="fc" id="L266"> this.commentMarker =
csvFormat.commentMarker;</span>
-<span class="fc" id="L267"> this.escapeCharacter =
csvFormat.escapeCharacter;</span>
-<span class="fc" id="L268"> this.ignoreSurroundingSpaces =
csvFormat.ignoreSurroundingSpaces;</span>
-<span class="fc" id="L269"> this.allowMissingColumnNames =
csvFormat.allowMissingColumnNames;</span>
-<span class="fc" id="L270"> this.ignoreEmptyLines =
csvFormat.ignoreEmptyLines;</span>
-<span class="fc" id="L271"> this.recordSeparator =
csvFormat.recordSeparator;</span>
-<span class="fc" id="L272"> this.nullString =
csvFormat.nullString;</span>
-<span class="fc" id="L273"> this.headerComments =
csvFormat.headerComments;</span>
-<span class="fc" id="L274"> this.headers = csvFormat.headers;</span>
-<span class="fc" id="L275"> this.skipHeaderRecord =
csvFormat.skipHeaderRecord;</span>
-<span class="fc" id="L276"> this.ignoreHeaderCase =
csvFormat.ignoreHeaderCase;</span>
-<span class="fc" id="L277"> this.lenientEof =
csvFormat.lenientEof;</span>
-<span class="fc" id="L278"> this.trailingData =
csvFormat.trailingData;</span>
-<span class="fc" id="L279"> this.trailingDelimiter =
csvFormat.trailingDelimiter;</span>
-<span class="fc" id="L280"> this.trim = csvFormat.trim;</span>
-<span class="fc" id="L281"> this.autoFlush =
csvFormat.autoFlush;</span>
-<span class="fc" id="L282"> this.quotedNullString =
csvFormat.quotedNullString;</span>
-<span class="fc" id="L283"> this.duplicateHeaderMode =
csvFormat.duplicateHeaderMode;</span>
-<span class="fc" id="L284"> }</span>
+<span class="fc" id="L277"> private Builder(final CSVFormat csvFormat)
{</span>
+<span class="fc" id="L278"> this.delimiter =
csvFormat.delimiter;</span>
+<span class="fc" id="L279"> this.quoteCharacter =
csvFormat.quoteCharacter;</span>
+<span class="fc" id="L280"> this.quoteMode =
csvFormat.quoteMode;</span>
+<span class="fc" id="L281"> this.commentMarker =
csvFormat.commentMarker;</span>
+<span class="fc" id="L282"> this.escapeCharacter =
csvFormat.escapeCharacter;</span>
+<span class="fc" id="L283"> this.ignoreSurroundingSpaces =
csvFormat.ignoreSurroundingSpaces;</span>
+<span class="fc" id="L284"> this.allowMissingColumnNames =
csvFormat.allowMissingColumnNames;</span>
+<span class="fc" id="L285"> this.ignoreEmptyLines =
csvFormat.ignoreEmptyLines;</span>
+<span class="fc" id="L286"> this.recordSeparator =
csvFormat.recordSeparator;</span>
+<span class="fc" id="L287"> this.nullString =
csvFormat.nullString;</span>
+<span class="fc" id="L288"> this.headerComments =
csvFormat.headerComments;</span>
+<span class="fc" id="L289"> this.headers = csvFormat.headers;</span>
+<span class="fc" id="L290"> this.skipHeaderRecord =
csvFormat.skipHeaderRecord;</span>
+<span class="fc" id="L291"> this.ignoreHeaderCase =
csvFormat.ignoreHeaderCase;</span>
+<span class="fc" id="L292"> this.lenientEof =
csvFormat.lenientEof;</span>
+<span class="fc" id="L293"> this.trailingData =
csvFormat.trailingData;</span>
+<span class="fc" id="L294"> this.trailingDelimiter =
csvFormat.trailingDelimiter;</span>
+<span class="fc" id="L295"> this.trim = csvFormat.trim;</span>
+<span class="fc" id="L296"> this.autoFlush =
csvFormat.autoFlush;</span>
+<span class="fc" id="L297"> this.quotedNullString =
csvFormat.quotedNullString;</span>
+<span class="fc" id="L298"> this.duplicateHeaderMode =
csvFormat.duplicateHeaderMode;</span>
+<span class="fc" id="L299"> }</span>
/**
* Builds a new CSVFormat instance.
@@ -291,7 +306,7 @@ public final class CSVFormat implements
*/
@Deprecated
public CSVFormat build() {
-<span class="fc" id="L294"> return get();</span>
+<span class="fc" id="L309"> return get();</span>
}
/**
@@ -302,7 +317,7 @@ public final class CSVFormat implements
*/
@Override
public CSVFormat get() {
-<span class="fc" id="L305"> return new CSVFormat(this);</span>
+<span class="fc" id="L320"> return new CSVFormat(this);</span>
}
/**
@@ -314,8 +329,8 @@ public final class CSVFormat implements
*/
@Deprecated
public Builder setAllowDuplicateHeaderNames(final boolean
allowDuplicateHeaderNames) {
-<span class="fc bfc" id="L317" title="All 2 branches covered.">
setDuplicateHeaderMode(allowDuplicateHeaderNames ?
DuplicateHeaderMode.ALLOW_ALL : DuplicateHeaderMode.ALLOW_EMPTY);</span>
-<span class="fc" id="L318"> return this;</span>
+<span class="fc bfc" id="L332" title="All 2 branches covered.">
setDuplicateHeaderMode(allowDuplicateHeaderNames ?
DuplicateHeaderMode.ALLOW_ALL : DuplicateHeaderMode.ALLOW_EMPTY);</span>
+<span class="fc" id="L333"> return this;</span>
}
/**
@@ -327,8 +342,8 @@ public final class CSVFormat implements
* @return This instance.
*/
public Builder setAllowMissingColumnNames(final boolean
allowMissingColumnNames) {
-<span class="fc" id="L330"> this.allowMissingColumnNames =
allowMissingColumnNames;</span>
-<span class="fc" id="L331"> return this;</span>
+<span class="fc" id="L345"> this.allowMissingColumnNames =
allowMissingColumnNames;</span>
+<span class="fc" id="L346"> return this;</span>
}
/**
@@ -338,8 +353,8 @@ public final class CSVFormat implements
* @return This instance.
*/
public Builder setAutoFlush(final boolean autoFlush) {
-<span class="fc" id="L341"> this.autoFlush = autoFlush;</span>
-<span class="fc" id="L342"> return this;</span>
+<span class="fc" id="L356"> this.autoFlush = autoFlush;</span>
+<span class="fc" id="L357"> return this;</span>
}
/**
@@ -377,8 +392,8 @@ public final class CSVFormat implements
* @throws IllegalArgumentException thrown if the specified character
is a line break
*/
public Builder setCommentMarker(final char commentMarker) {
-<span class="fc" id="L380">
setCommentMarker(Character.valueOf(commentMarker));</span>
-<span class="fc" id="L381"> return this;</span>
+<span class="fc" id="L395">
setCommentMarker(Character.valueOf(commentMarker));</span>
+<span class="fc" id="L396"> return this;</span>
}
/**
@@ -416,11 +431,11 @@ public final class CSVFormat implements
* @throws IllegalArgumentException thrown if the specified character
is a line break
*/
public Builder setCommentMarker(final Character commentMarker) {
-<span class="fc bfc" id="L419" title="All 2 branches covered."> if
(isLineBreak(commentMarker)) {</span>
-<span class="fc" id="L420"> throw new
IllegalArgumentException("The comment start marker character cannot be a
line break");</span>
+<span class="fc bfc" id="L434" title="All 2 branches covered."> if
(isLineBreak(commentMarker)) {</span>
+<span class="fc" id="L435"> throw new
IllegalArgumentException("The comment start marker character cannot be a
line break");</span>
}
-<span class="fc" id="L422"> this.commentMarker =
commentMarker;</span>
-<span class="fc" id="L423"> return this;</span>
+<span class="fc" id="L437"> this.commentMarker =
commentMarker;</span>
+<span class="fc" id="L438"> return this;</span>
}
/**
@@ -430,7 +445,7 @@ public final class CSVFormat implements
* @return This instance.
*/
public Builder setDelimiter(final char delimiter) {
-<span class="fc" id="L433"> return
setDelimiter(String.valueOf(delimiter));</span>
+<span class="fc" id="L448"> return
setDelimiter(String.valueOf(delimiter));</span>
}
/**
@@ -440,14 +455,14 @@ public final class CSVFormat implements
* @return This instance.
*/
public Builder setDelimiter(final String delimiter) {
-<span class="fc bfc" id="L443" title="All 2 branches covered."> if
(containsLineBreak(delimiter)) {</span>
-<span class="fc" id="L444"> throw new
IllegalArgumentException("The delimiter cannot be a line
break");</span>
+<span class="fc bfc" id="L458" title="All 2 branches covered."> if
(containsLineBreak(delimiter)) {</span>
+<span class="fc" id="L459"> throw new
IllegalArgumentException("The delimiter cannot be a line
break");</span>
}
-<span class="fc bfc" id="L446" title="All 2 branches covered."> if
(delimiter.isEmpty()) {</span>
-<span class="fc" id="L447"> throw new
IllegalArgumentException("The delimiter cannot be empty");</span>
+<span class="fc bfc" id="L461" title="All 2 branches covered."> if
(delimiter.isEmpty()) {</span>
+<span class="fc" id="L462"> throw new
IllegalArgumentException("The delimiter cannot be empty");</span>
}
-<span class="fc" id="L449"> this.delimiter = delimiter;</span>
-<span class="fc" id="L450"> return this;</span>
+<span class="fc" id="L464"> this.delimiter = delimiter;</span>
+<span class="fc" id="L465"> return this;</span>
}
/**
@@ -458,8 +473,8 @@ public final class CSVFormat implements
* @since 1.10.0
*/
public Builder setDuplicateHeaderMode(final DuplicateHeaderMode
duplicateHeaderMode) {
-<span class="fc" id="L461"> this.duplicateHeaderMode =
Objects.requireNonNull(duplicateHeaderMode,
"duplicateHeaderMode");</span>
-<span class="fc" id="L462"> return this;</span>
+<span class="fc" id="L476"> this.duplicateHeaderMode =
Objects.requireNonNull(duplicateHeaderMode,
"duplicateHeaderMode");</span>
+<span class="fc" id="L477"> return this;</span>
}
/**
@@ -470,8 +485,8 @@ public final class CSVFormat implements
* @throws IllegalArgumentException thrown if the specified character
is a line break
*/
public Builder setEscape(final char escapeCharacter) {
-<span class="fc" id="L473">
setEscape(Character.valueOf(escapeCharacter));</span>
-<span class="fc" id="L474"> return this;</span>
+<span class="fc" id="L488">
setEscape(Character.valueOf(escapeCharacter));</span>
+<span class="fc" id="L489"> return this;</span>
}
/**
@@ -482,11 +497,11 @@ public final class CSVFormat implements
* @throws IllegalArgumentException thrown if the specified character
is a line break
*/
public Builder setEscape(final Character escapeCharacter) {
-<span class="fc bfc" id="L485" title="All 2 branches covered."> if
(isLineBreak(escapeCharacter)) {</span>
-<span class="fc" id="L486"> throw new
IllegalArgumentException("The escape character cannot be a line
break");</span>
+<span class="fc bfc" id="L500" title="All 2 branches covered."> if
(isLineBreak(escapeCharacter)) {</span>
+<span class="fc" id="L501"> throw new
IllegalArgumentException("The escape character cannot be a line
break");</span>
}
-<span class="fc" id="L488"> this.escapeCharacter =
escapeCharacter;</span>
-<span class="fc" id="L489"> return this;</span>
+<span class="fc" id="L503"> this.escapeCharacter =
escapeCharacter;</span>
+<span class="fc" id="L504"> return this;</span>
}
/**
@@ -511,13 +526,13 @@ public final class CSVFormat implements
* @return This instance.
*/
public Builder setHeader(final Class<? extends Enum<?>>
headerEnum) {
-<span class="fc" id="L514"> String[] header = null;</span>
-<span class="fc bfc" id="L515" title="All 2 branches covered."> if
(headerEnum != null) {</span>
-<span class="fc" id="L516"> final Enum<?>[] enumValues =
headerEnum.getEnumConstants();</span>
-<span class="fc" id="L517"> header = new
String[enumValues.length];</span>
-<span class="fc" id="L518"> Arrays.setAll(header, i ->
enumValues[i].name());</span>
+<span class="fc" id="L529"> String[] header = null;</span>
+<span class="fc bfc" id="L530" title="All 2 branches covered."> if
(headerEnum != null) {</span>
+<span class="fc" id="L531"> final Enum<?>[] enumValues =
headerEnum.getEnumConstants();</span>
+<span class="fc" id="L532"> header = new
String[enumValues.length];</span>
+<span class="fc" id="L533"> Arrays.setAll(header, i ->
enumValues[i].name());</span>
}
-<span class="fc" id="L520"> return setHeader(header);</span>
+<span class="fc" id="L535"> return setHeader(header);</span>
}
/**
@@ -541,7 +556,7 @@ public final class CSVFormat implements
* @throws SQLException SQLException if a database access error occurs
or this method is called on a closed result set.
*/
public Builder setHeader(final ResultSet resultSet) throws
SQLException {
-<span class="fc bfc" id="L544" title="All 2 branches covered.">
return setHeader(resultSet != null ? resultSet.getMetaData() : null);</span>
+<span class="fc bfc" id="L559" title="All 2 branches covered.">
return setHeader(resultSet != null ? resultSet.getMetaData() : null);</span>
}
/**
@@ -565,15 +580,15 @@ public final class CSVFormat implements
* @throws SQLException SQLException if a database access error occurs
or this method is called on a closed result set.
*/
public Builder setHeader(final ResultSetMetaData resultSetMetaData)
throws SQLException {
-<span class="fc" id="L568"> String[] labels = null;</span>
-<span class="fc bfc" id="L569" title="All 2 branches covered."> if
(resultSetMetaData != null) {</span>
-<span class="fc" id="L570"> final int columnCount =
resultSetMetaData.getColumnCount();</span>
-<span class="fc" id="L571"> labels = new
String[columnCount];</span>
-<span class="fc bfc" id="L572" title="All 2 branches covered.">
for (int i = 0; i < columnCount; i++) {</span>
-<span class="fc" id="L573"> labels[i] =
resultSetMetaData.getColumnLabel(i + 1);</span>
+<span class="fc" id="L583"> String[] labels = null;</span>
+<span class="fc bfc" id="L584" title="All 2 branches covered."> if
(resultSetMetaData != null) {</span>
+<span class="fc" id="L585"> final int columnCount =
resultSetMetaData.getColumnCount();</span>
+<span class="fc" id="L586"> labels = new
String[columnCount];</span>
+<span class="fc bfc" id="L587" title="All 2 branches covered.">
for (int i = 0; i < columnCount; i++) {</span>
+<span class="fc" id="L588"> labels[i] =
resultSetMetaData.getColumnLabel(i + 1);</span>
}
}
-<span class="fc" id="L576"> return setHeader(labels);</span>
+<span class="fc" id="L591"> return setHeader(labels);</span>
}
/**
@@ -596,8 +611,8 @@ public final class CSVFormat implements
* @return This instance.
*/
public Builder setHeader(final String... header) {
-<span class="fc" id="L599"> this.headers =
CSVFormat.clone(header);</span>
-<span class="fc" id="L600"> return this;</span>
+<span class="fc" id="L614"> this.headers =
CSVFormat.clone(header);</span>
+<span class="fc" id="L615"> return this;</span>
}
/**
@@ -634,8 +649,8 @@ public final class CSVFormat implements
* @return This instance.
*/
public Builder setHeaderComments(final Object... headerComments) {
-<span class="fc" id="L637"> this.headerComments =
CSVFormat.clone(toStringArray(headerComments));</span>
-<span class="fc" id="L638"> return this;</span>
+<span class="fc" id="L652"> this.headerComments =
CSVFormat.clone(toStringArray(headerComments));</span>
+<span class="fc" id="L653"> return this;</span>
}
/**
@@ -672,8 +687,8 @@ public final class CSVFormat implements
* @return This instance.
*/
public Builder setHeaderComments(final String... headerComments) {
-<span class="fc" id="L675"> this.headerComments =
CSVFormat.clone(headerComments);</span>
-<span class="fc" id="L676"> return this;</span>
+<span class="fc" id="L690"> this.headerComments =
CSVFormat.clone(headerComments);</span>
+<span class="fc" id="L691"> return this;</span>
}
/**
@@ -685,8 +700,8 @@ public final class CSVFormat implements
* @return This instance.
*/
public Builder setIgnoreEmptyLines(final boolean ignoreEmptyLines) {
-<span class="fc" id="L688"> this.ignoreEmptyLines =
ignoreEmptyLines;</span>
-<span class="fc" id="L689"> return this;</span>
+<span class="fc" id="L703"> this.ignoreEmptyLines =
ignoreEmptyLines;</span>
+<span class="fc" id="L704"> return this;</span>
}
/**
@@ -696,8 +711,8 @@ public final class CSVFormat implements
* @return This instance.
*/
public Builder setIgnoreHeaderCase(final boolean ignoreHeaderCase) {
-<span class="fc" id="L699"> this.ignoreHeaderCase =
ignoreHeaderCase;</span>
-<span class="fc" id="L700"> return this;</span>
+<span class="fc" id="L714"> this.ignoreHeaderCase =
ignoreHeaderCase;</span>
+<span class="fc" id="L715"> return this;</span>
}
/**
@@ -707,8 +722,8 @@ public final class CSVFormat implements
* @return This instance.
*/
public Builder setIgnoreSurroundingSpaces(final boolean
ignoreSurroundingSpaces) {
-<span class="fc" id="L710"> this.ignoreSurroundingSpaces =
ignoreSurroundingSpaces;</span>
-<span class="fc" id="L711"> return this;</span>
+<span class="fc" id="L725"> this.ignoreSurroundingSpaces =
ignoreSurroundingSpaces;</span>
+<span class="fc" id="L726"> return this;</span>
}
/**
@@ -719,8 +734,8 @@ public final class CSVFormat implements
* @since 1.11.0
*/
public Builder setLenientEof(final boolean lenientEof) {
-<span class="fc" id="L722"> this.lenientEof = lenientEof;</span>
-<span class="fc" id="L723"> return this;</span>
+<span class="fc" id="L737"> this.lenientEof = lenientEof;</span>
+<span class="fc" id="L738"> return this;</span>
}
/**
@@ -735,9 +750,9 @@ public final class CSVFormat implements
* @return This instance.
*/
public Builder setNullString(final String nullString) {
-<span class="fc" id="L738"> this.nullString = nullString;</span>
-<span class="fc" id="L739"> this.quotedNullString = quoteCharacter
+ nullString + quoteCharacter;</span>
-<span class="fc" id="L740"> return this;</span>
+<span class="fc" id="L753"> this.nullString = nullString;</span>
+<span class="fc" id="L754"> this.quotedNullString = quoteCharacter
+ nullString + quoteCharacter;</span>
+<span class="fc" id="L755"> return this;</span>
}
/**
@@ -747,8 +762,8 @@ public final class CSVFormat implements
* @return This instance.
*/
public Builder setQuote(final char quoteCharacter) {
-<span class="fc" id="L750">
setQuote(Character.valueOf(quoteCharacter));</span>
-<span class="fc" id="L751"> return this;</span>
+<span class="fc" id="L765">
setQuote(Character.valueOf(quoteCharacter));</span>
+<span class="fc" id="L766"> return this;</span>
}
/**
@@ -758,11 +773,11 @@ public final class CSVFormat implements
* @return This instance.
*/
public Builder setQuote(final Character quoteCharacter) {
-<span class="fc bfc" id="L761" title="All 2 branches covered."> if
(isLineBreak(quoteCharacter)) {</span>
-<span class="fc" id="L762"> throw new
IllegalArgumentException("The quoteChar cannot be a line
break");</span>
+<span class="fc bfc" id="L776" title="All 2 branches covered."> if
(isLineBreak(quoteCharacter)) {</span>
+<span class="fc" id="L777"> throw new
IllegalArgumentException("The quoteCharacter cannot be a line
break");</span>
}
-<span class="fc" id="L764"> this.quoteCharacter =
quoteCharacter;</span>
-<span class="fc" id="L765"> return this;</span>
+<span class="fc" id="L779"> this.quoteCharacter =
quoteCharacter;</span>
+<span class="fc" id="L780"> return this;</span>
}
/**
@@ -772,8 +787,8 @@ public final class CSVFormat implements
* @return This instance.
*/
public Builder setQuoteMode(final QuoteMode quoteMode) {
-<span class="fc" id="L775"> this.quoteMode = quoteMode;</span>
-<span class="fc" id="L776"> return this;</span>
+<span class="fc" id="L790"> this.quoteMode = quoteMode;</span>
+<span class="fc" id="L791"> return this;</span>
}
/**
@@ -788,8 +803,8 @@ public final class CSVFormat implements
* @return This instance.
*/
public Builder setRecordSeparator(final char recordSeparator) {
-<span class="fc" id="L791"> this.recordSeparator =
String.valueOf(recordSeparator);</span>
-<span class="fc" id="L792"> return this;</span>
+<span class="fc" id="L806"> this.recordSeparator =
String.valueOf(recordSeparator);</span>
+<span class="fc" id="L807"> return this;</span>
}
/**
@@ -804,8 +819,8 @@ public final class CSVFormat implements
* @return This instance.
*/
public Builder setRecordSeparator(final String recordSeparator) {
-<span class="fc" id="L807"> this.recordSeparator =
recordSeparator;</span>
-<span class="fc" id="L808"> return this;</span>
+<span class="fc" id="L822"> this.recordSeparator =
recordSeparator;</span>
+<span class="fc" id="L823"> return this;</span>
}
/**
@@ -815,8 +830,8 @@ public final class CSVFormat implements
* @return This instance.
*/
public Builder setSkipHeaderRecord(final boolean skipHeaderRecord) {
-<span class="fc" id="L818"> this.skipHeaderRecord =
skipHeaderRecord;</span>
-<span class="fc" id="L819"> return this;</span>
+<span class="fc" id="L833"> this.skipHeaderRecord =
skipHeaderRecord;</span>
+<span class="fc" id="L834"> return this;</span>
}
/**
@@ -827,8 +842,8 @@ public final class CSVFormat implements
* @since 1.11.0
*/
public Builder setTrailingData(final boolean trailingData) {
-<span class="fc" id="L830"> this.trailingData = trailingData;</span>
-<span class="fc" id="L831"> return this;</span>
+<span class="fc" id="L845"> this.trailingData = trailingData;</span>
+<span class="fc" id="L846"> return this;</span>
}
/**
@@ -838,8 +853,8 @@ public final class CSVFormat implements
* @return This instance.
*/
public Builder setTrailingDelimiter(final boolean trailingDelimiter) {
-<span class="fc" id="L841"> this.trailingDelimiter =
trailingDelimiter;</span>
-<span class="fc" id="L842"> return this;</span>
+<span class="fc" id="L856"> this.trailingDelimiter =
trailingDelimiter;</span>
+<span class="fc" id="L857"> return this;</span>
}
/**
@@ -849,8 +864,8 @@ public final class CSVFormat implements
* @return This instance.
*/
public Builder setTrim(final boolean trim) {
-<span class="fc" id="L852"> this.trim = trim;</span>
-<span class="fc" id="L853"> return this;</span>
+<span class="fc" id="L867"> this.trim = trim;</span>
+<span class="fc" id="L868"> return this;</span>
}
}
@@ -859,21 +874,21 @@ public final class CSVFormat implements
*
* @since 1.2
*/
-<span class="fc" id="L862"> public enum Predefined {</span>
+<span class="fc" id="L877"> public enum Predefined {</span>
/**
* The DEFAULT predefined format.
*
* @see CSVFormat#DEFAULT
*/
-<span class="fc" id="L869"> Default(DEFAULT),</span>
+<span class="fc" id="L884"> Default(DEFAULT),</span>
/**
* The EXCEL predefined format.
*
* @see CSVFormat#EXCEL
*/
-<span class="fc" id="L876"> Excel(EXCEL),</span>
+<span class="fc" id="L891"> Excel(EXCEL),</span>
/**
* The INFORMIX_UNLOAD predefined format.
@@ -881,7 +896,7 @@ public final class CSVFormat implements
* @see CSVFormat#INFORMIX_UNLOAD
* @since 1.3
*/
-<span class="fc" id="L884"> InformixUnload(INFORMIX_UNLOAD),</span>
+<span class="fc" id="L899"> InformixUnload(INFORMIX_UNLOAD),</span>
/**
* The INFORMIX_UNLOAD_CSV predefined format.
@@ -889,7 +904,7 @@ public final class CSVFormat implements
* @see CSVFormat#INFORMIX_UNLOAD_CSV
* @since 1.3
*/
-<span class="fc" id="L892">
InformixUnloadCsv(INFORMIX_UNLOAD_CSV),</span>
+<span class="fc" id="L907">
InformixUnloadCsv(INFORMIX_UNLOAD_CSV),</span>
/**
* The MONGODB_CSV predefined format.
@@ -897,7 +912,7 @@ public final class CSVFormat implements
* @see CSVFormat#MONGODB_CSV
* @since 1.7
*/
-<span class="fc" id="L900"> MongoDBCsv(MONGODB_CSV),</span>
+<span class="fc" id="L915"> MongoDBCsv(MONGODB_CSV),</span>
/**
* The MONGODB_TSV predefined format.
@@ -905,21 +920,21 @@ public final class CSVFormat implements
* @see CSVFormat#MONGODB_TSV
* @since 1.7
*/
-<span class="fc" id="L908"> MongoDBTsv(MONGODB_TSV),</span>
+<span class="fc" id="L923"> MongoDBTsv(MONGODB_TSV),</span>
/**
* The MYSQL predefined format.
*
* @see CSVFormat#MYSQL
*/
-<span class="fc" id="L915"> MySQL(MYSQL),</span>
+<span class="fc" id="L930"> MySQL(MYSQL),</span>
/**
* The ORACLE predefined format.
*
* @see CSVFormat#ORACLE
*/
-<span class="fc" id="L922"> Oracle(ORACLE),</span>
+<span class="fc" id="L937"> Oracle(ORACLE),</span>
/**
* The POSTGRESQL_CSV predefined format.
@@ -927,34 +942,34 @@ public final class CSVFormat implements
* @see CSVFormat#POSTGRESQL_CSV
* @since 1.5
*/
-<span class="fc" id="L930"> PostgreSQLCsv(POSTGRESQL_CSV),</span>
+<span class="fc" id="L945"> PostgreSQLCsv(POSTGRESQL_CSV),</span>
/**
* The POSTGRESQL_TEXT predefined format.
*
* @see CSVFormat#POSTGRESQL_TEXT
*/
-<span class="fc" id="L937"> PostgreSQLText(POSTGRESQL_TEXT),</span>
+<span class="fc" id="L952"> PostgreSQLText(POSTGRESQL_TEXT),</span>
/**
* The RFC4180 predefined format.
*
* @see CSVFormat#RFC4180
*/
-<span class="fc" id="L944"> RFC4180(CSVFormat.RFC4180),</span>
+<span class="fc" id="L959"> RFC4180(CSVFormat.RFC4180),</span>
/**
* The TDF predefined format.
*
* @see CSVFormat#TDF
*/
-<span class="fc" id="L951"> TDF(CSVFormat.TDF);</span>
+<span class="fc" id="L966"> TDF(CSVFormat.TDF);</span>
private final CSVFormat format;
-<span class="fc" id="L955"> Predefined(final CSVFormat format) {</span>
-<span class="fc" id="L956"> this.format = format;</span>
-<span class="fc" id="L957"> }</span>
+<span class="fc" id="L970"> Predefined(final CSVFormat format) {</span>
+<span class="fc" id="L971"> this.format = format;</span>
+<span class="fc" id="L972"> }</span>
/**
* Gets the format.
@@ -962,7 +977,7 @@ public final class CSVFormat implements
* @return the format.
*/
public CSVFormat getFormat() {
-<span class="fc" id="L965"> return format;</span>
+<span class="fc" id="L980"> return format;</span>
}
}
@@ -973,16 +988,17 @@ public final class CSVFormat implements
* The {@link Builder} settings are:
* </p>
* <ul>
- * <li>{@code setDelimiter(',')}</li>
- * <li>{@code setQuote('"')}</li>
- * <li>{@code setRecordSeparator("\r\n")}</li>
- * <li>{@code setIgnoreEmptyLines(true)}</li>
- * <li>{@code
setDuplicateHeaderMode(DuplicateHeaderMode.ALLOW_ALL)}</li>
+ * <li>{@link Builder#setDelimiter(char) setDelimiter}{@code
(',')}</li>
+ * <li>{@link Builder#setQuote(char) setQuote}{@code
('"')}</li>
+ * <li>{@link Builder#setRecordSeparator(String)
setRecordSeparator}{@code ("\r\n")}</li>
+ * <li>{@link Builder#setIgnoreEmptyLines(boolean)
setIgnoreEmptyLines}{@code (true)}</li>
+ * <li>{@link Builder#setDuplicateHeaderMode(DuplicateHeaderMode)
setDuplicateHeaderMode}{@code (DuplicateHeaderMode.ALLOW_ALL)}</li>
* </ul>
*
* @see Predefined#Default
+ * @see DuplicateHeaderMode#ALLOW_ALL
*/
-<span class="fc" id="L985"> public static final CSVFormat DEFAULT = new
CSVFormat(Builder.create());</span>
+<span class="fc" id="L1001"> public static final CSVFormat DEFAULT = new
CSVFormat(Builder.create());</span>
/**
* Excel file format (using a comma as the value delimiter). Note that the
actual value delimiter used by Excel is locale-dependent, it might be necessary
@@ -997,17 +1013,17 @@ public final class CSVFormat implements
* </pre>
*
* <p>
- * The {@link Builder} settings are:
+ * The {@link Builder} settings are the {@link #DEFAULT}
<em>with</em>:
* </p>
* <ul>
- * <li>{@code setDelimiter(',')}</li>
- * <li>{@code setQuote('"')}</li>
- * <li>{@code setRecordSeparator("\r\n")}</li>
- * <li>{@code
setDuplicateHeaderMode(DuplicateHeaderMode.ALLOW_ALL)}</li>
- * <li>{@code setIgnoreEmptyLines(false)}</li>
- * <li>{@code setAllowMissingColumnNames(true)}</li>
- * <li>{@code setTrailingData(true)}</li>
- * <li>{@code setLenientEof(true)}</li>
+ * <li>{@link Builder#setDelimiter(char) setDelimiter}{@code
(',')}</li>
+ * <li>{@link Builder#setQuote(char) setQuote}{@code
('"')}</li>
+ * <li>{@link Builder#setRecordSeparator(String)
setRecordSeparator}{@code ("\r\n")}</li>
+ * <li>{@link Builder#setDuplicateHeaderMode(DuplicateHeaderMode)
setDuplicateHeaderMode}{@code (DuplicateHeaderMode.ALLOW_ALL)}</li>
+ * <li>{@link Builder#setIgnoreEmptyLines(boolean)
setIgnoreEmptyLines}{@code (false)}</li>
+ * <li>{@link Builder#setAllowMissingColumnNames(boolean)
setAllowMissingColumnNames}{@code (true)}</li>
+ * <li>{@link Builder#setTrailingData(boolean)
setTrailingData}{@code (true)}</li>
+ * <li>{@link Builder#setLenientEof(boolean) setLenientEof}{@code
(true)}</li>
* </ul>
* <p>
* Note: This is currently like {@link #RFC4180} plus {@link
Builder#setAllowMissingColumnNames(boolean)
Builder#setAllowMissingColumnNames(true)} and
@@ -1015,14 +1031,15 @@ public final class CSVFormat implements
* </p>
*
* @see Predefined#Excel
+ * @see DuplicateHeaderMode#ALLOW_ALL
*/
// @formatter:off
-<span class="fc" id="L1020"> public static final CSVFormat EXCEL =
DEFAULT.builder()</span>
-<span class="fc" id="L1021"> .setIgnoreEmptyLines(false)</span>
-<span class="fc" id="L1022">
.setAllowMissingColumnNames(true)</span>
-<span class="fc" id="L1023"> .setTrailingData(true)</span>
-<span class="fc" id="L1024"> .setLenientEof(true)</span>
-<span class="fc" id="L1025"> .get();</span>
+<span class="fc" id="L1037"> public static final CSVFormat EXCEL =
DEFAULT.builder()</span>
+<span class="fc" id="L1038"> .setIgnoreEmptyLines(false)</span>
+<span class="fc" id="L1039">
.setAllowMissingColumnNames(true)</span>
+<span class="fc" id="L1040"> .setTrailingData(true)</span>
+<span class="fc" id="L1041"> .setLenientEof(true)</span>
+<span class="fc" id="L1042"> .get();</span>
// @formatter:on
/**
@@ -1034,13 +1051,13 @@ public final class CSVFormat implements
* </p>
*
* <p>
- * The {@link Builder} settings are:
+ * The {@link Builder} settings are the {@link #DEFAULT}
<em>with</em>:
* </p>
* <ul>
- * <li>{@code setDelimiter(',')}</li>
- * <li>{@code setEscape('\\')}</li>
- * <li>{@code setQuote("\"")}</li>
- * <li>{@code setRecordSeparator('\n')}</li>
+ * <li>{@link Builder#setDelimiter(char) setDelimiter}{@code
(',')}</li>
+ * <li>{@link Builder#setEscape(char) setEscape}{@code
('\\')}</li>
+ * <li>{@link Builder#setQuote(char) setQuote}{@code
('\"')}</li>
+ * <li>{@link Builder#setRecordSeparator(char)
setRecordSeparator}{@code ('\n')}</li>
* </ul>
*
* @see Predefined#MySQL
@@ -1049,12 +1066,12 @@ public final class CSVFormat implements
* @since 1.3
*/
// @formatter:off
-<span class="fc" id="L1052"> public static final CSVFormat INFORMIX_UNLOAD
= DEFAULT.builder()</span>
-<span class="fc" id="L1053"> .setDelimiter(Constants.PIPE)</span>
-<span class="fc" id="L1054"> .setEscape(Constants.BACKSLASH)</span>
-<span class="fc" id="L1055">
.setQuote(Constants.DOUBLE_QUOTE_CHAR)</span>
-<span class="fc" id="L1056">
.setRecordSeparator(Constants.LF)</span>
-<span class="fc" id="L1057"> .get();</span>
+<span class="fc" id="L1069"> public static final CSVFormat INFORMIX_UNLOAD
= DEFAULT.builder()</span>
+<span class="fc" id="L1070"> .setDelimiter(Constants.PIPE)</span>
+<span class="fc" id="L1071"> .setEscape(Constants.BACKSLASH)</span>
+<span class="fc" id="L1072">
.setQuote(Constants.DOUBLE_QUOTE_CHAR)</span>
+<span class="fc" id="L1073">
.setRecordSeparator(Constants.LF)</span>
+<span class="fc" id="L1074"> .get();</span>
// @formatter:on
/**
@@ -1066,12 +1083,12 @@ public final class CSVFormat implements
* </p>
*
* <p>
- * The {@link Builder} settings are:
+ * The {@link Builder} settings are the {@link #DEFAULT}
<em>with</em>:
* </p>
* <ul>
- * <li>{@code setDelimiter(',')}</li>
- * <li>{@code setQuote("\"")}</li>
- * <li>{@code setRecordSeparator('\n')}</li>
+ * <li>{@link Builder#setDelimiter(char) setDelimiter}{@code
(',')}</li>
+ * <li>{@link Builder#setQuote(char) setQuote}{@code
('\"')}</li>
+ * <li>{@link Builder#setRecordSeparator(char)
setRecordSeparator}{@code ('\n')}</li>
* </ul>
*
* @see Predefined#MySQL
@@ -1080,11 +1097,11 @@ public final class CSVFormat implements
* @since 1.3
*/
// @formatter:off
-<span class="fc" id="L1083"> public static final CSVFormat
INFORMIX_UNLOAD_CSV = DEFAULT.builder()</span>
-<span class="fc" id="L1084"> .setDelimiter(Constants.COMMA)</span>
-<span class="fc" id="L1085">
.setQuote(Constants.DOUBLE_QUOTE_CHAR)</span>
-<span class="fc" id="L1086">
.setRecordSeparator(Constants.LF)</span>
-<span class="fc" id="L1087"> .get();</span>
+<span class="fc" id="L1100"> public static final CSVFormat
INFORMIX_UNLOAD_CSV = DEFAULT.builder()</span>
+<span class="fc" id="L1101"> .setDelimiter(Constants.COMMA)</span>
+<span class="fc" id="L1102">
.setQuote(Constants.DOUBLE_QUOTE_CHAR)</span>
+<span class="fc" id="L1103">
.setRecordSeparator(Constants.LF)</span>
+<span class="fc" id="L1104"> .get();</span>
// @formatter:on
/**
@@ -1104,28 +1121,27 @@ public final class CSVFormat implements
* not a valid escape character. If you use double-quotes to enclose
fields in the CSV data, you must escape internal double-quote marks by
prepending
* another double-quote. </blockquote>
* <p>
- * The {@link Builder} settings are:
+ * The {@link Builder} settings are the {@link #DEFAULT}
<em>with</em>:
* </p>
* <ul>
- * <li>{@code setDelimiter(',')}</li>
- * <li>{@code setEscape('"')}</li>
- * <li>{@code setQuote('"')}</li>
- * <li>{@code setQuoteMode(QuoteMode.ALL_NON_NULL)}</li>
- * <li>{@code setSkipHeaderRecord(false)}</li>
+ * <li>{@link Builder#setDelimiter(char) setDelimiter}{@code
(',')}</li>
+ * <li>{@link Builder#setEscape(char) setEscape}{@code
('"')}</li>
+ * <li>{@link Builder#setQuote(char) setQuote}{@code
('"')}</li>
+ * <li>{@link Builder#setQuoteMode(QuoteMode) setQuoteMode}{@code
(QuoteMode.ALL_NON_NULL)}</li>
* </ul>
*
* @see Predefined#MongoDBCsv
+ * @see QuoteMode#ALL_NON_NULL
* @see <a
href="https://docs.mongodb.com/manual/reference/program/mongoexport/">MongoDB
mongoexport command documentation</a>
* @since 1.7
*/
// @formatter:off
-<span class="fc" id="L1122"> public static final CSVFormat MONGODB_CSV =
DEFAULT.builder()</span>
-<span class="fc" id="L1123"> .setDelimiter(Constants.COMMA)</span>
-<span class="fc" id="L1124">
.setEscape(Constants.DOUBLE_QUOTE_CHAR)</span>
-<span class="fc" id="L1125">
.setQuote(Constants.DOUBLE_QUOTE_CHAR)</span>
-<span class="fc" id="L1126"> .setQuoteMode(QuoteMode.MINIMAL)</span>
-<span class="fc" id="L1127"> .setSkipHeaderRecord(false)</span>
-<span class="fc" id="L1128"> .get();</span>
+<span class="fc" id="L1139"> public static final CSVFormat MONGODB_CSV =
DEFAULT.builder()</span>
+<span class="fc" id="L1140"> .setDelimiter(Constants.COMMA)</span>
+<span class="fc" id="L1141">
.setEscape(Constants.DOUBLE_QUOTE_CHAR)</span>
+<span class="fc" id="L1142">
.setQuote(Constants.DOUBLE_QUOTE_CHAR)</span>
+<span class="fc" id="L1143"> .setQuoteMode(QuoteMode.MINIMAL)</span>
+<span class="fc" id="L1144"> .get();</span>
// @formatter:off
/**
@@ -1140,29 +1156,30 @@ public final class CSVFormat implements
* </p>
*
* <p>
- * The {@link Builder} settings are:
+ * The {@link Builder} settings are the {@link #DEFAULT}
<em>with</em>:
* </p>
* <ul>
- * <li>{@code setDelimiter('\t')}</li>
- * <li>{@code setEscape('"')}</li>
- * <li>{@code setQuote('"')}</li>
- * <li>{@code setQuoteMode(QuoteMode.ALL_NON_NULL)}</li>
+ * <li>{@link Builder#setDelimiter(char) setDelimiter}{@code
('\t')}</li>
+ * <li>{@link Builder#setEscape(char) setEscape}{@code
('"')}</li>
+ * <li>{@link Builder#setQuote(char) setQuote}{@code
('"')}</li>
+ * <li>{@link Builder#setQuoteMode(QuoteMode) setQuoteMode}{@code
(QuoteMode.ALL_NON_NULL)}</li>
* <li>{@code setSkipHeaderRecord(false)}</li>
* </ul>
*
* @see Predefined#MongoDBCsv
+ * @see QuoteMode#ALL_NON_NULL
* @see <a
href="https://docs.mongodb.com/manual/reference/program/mongoexport/">MongoDB
mongoexport command
* documentation</a>
* @since 1.7
*/
// @formatter:off
-<span class="fc" id="L1159"> public static final CSVFormat MONGODB_TSV =
DEFAULT.builder()</span>
-<span class="fc" id="L1160"> .setDelimiter(Constants.TAB)</span>
-<span class="fc" id="L1161">
.setEscape(Constants.DOUBLE_QUOTE_CHAR)</span>
-<span class="fc" id="L1162">
.setQuote(Constants.DOUBLE_QUOTE_CHAR)</span>
-<span class="fc" id="L1163"> .setQuoteMode(QuoteMode.MINIMAL)</span>
-<span class="fc" id="L1164"> .setSkipHeaderRecord(false)</span>
-<span class="fc" id="L1165"> .get();</span>
+<span class="fc" id="L1176"> public static final CSVFormat MONGODB_TSV =
DEFAULT.builder()</span>
+<span class="fc" id="L1177"> .setDelimiter(Constants.TAB)</span>
+<span class="fc" id="L1178">
.setEscape(Constants.DOUBLE_QUOTE_CHAR)</span>
+<span class="fc" id="L1179">
.setQuote(Constants.DOUBLE_QUOTE_CHAR)</span>
+<span class="fc" id="L1180"> .setQuoteMode(QuoteMode.MINIMAL)</span>
+<span class="fc" id="L1181"> .setSkipHeaderRecord(false)</span>
+<span class="fc" id="L1182"> .get();</span>
// @formatter:off
/**
@@ -1174,32 +1191,33 @@ public final class CSVFormat implements
* </p>
*
* <p>
- * The {@link Builder} settings are:
+ * The {@link Builder} settings are the {@link #DEFAULT}
<em>with</em>:
* </p>
* <ul>
- * <li>{@code setDelimiter('\t')}</li>
- * <li>{@code setEscape('\\')}</li>
- * <li>{@code setIgnoreEmptyLines(false)}</li>
- * <li>{@code setQuote(null)}</li>
- * <li>{@code setRecordSeparator('\n')}</li>
- * <li>{@code setNullString("\\N")}</li>
- * <li>{@code setQuoteMode(QuoteMode.ALL_NON_NULL)}</li>
+ * <li>{@link Builder#setDelimiter(char) setDelimiter}{@code
('\t')}</li>
+ * <li>{@link Builder#setEscape(char) setEscape}{@code
('\\')}</li>
+ * <li>{@link Builder#setIgnoreEmptyLines(boolean)
setIgnoreEmptyLines}{@code (false)}</li>
+ * <li>{@link Builder#setQuote(Character) setQuote}{@code
(null)}</li>
+ * <li>{@link Builder#setRecordSeparator(char)
setRecordSeparator}{@code ('\n')}</li>
+ * <li>{@link Builder#setNullString(String) setNullString}{@code
("\\N")}</li>
+ * <li>{@link Builder#setQuoteMode(QuoteMode) setQuoteMode}{@code
(QuoteMode.ALL_NON_NULL)}</li>
* </ul>
*
* @see Predefined#MySQL
+ * @see QuoteMode#ALL_NON_NULL
* @see <a
href="https://dev.mysql.com/doc/refman/5.1/en/load-data.html">
https://dev.mysql.com/doc/refman/5.1/en/load
* -data.html</a>
*/
// @formatter:off
-<span class="fc" id="L1194"> public static final CSVFormat MYSQL =
DEFAULT.builder()</span>
-<span class="fc" id="L1195"> .setDelimiter(Constants.TAB)</span>
-<span class="fc" id="L1196"> .setEscape(Constants.BACKSLASH)</span>
-<span class="fc" id="L1197"> .setIgnoreEmptyLines(false)</span>
-<span class="fc" id="L1198"> .setQuote(null)</span>
-<span class="fc" id="L1199">
.setRecordSeparator(Constants.LF)</span>
-<span class="fc" id="L1200">
.setNullString(Constants.SQL_NULL_STRING)</span>
-<span class="fc" id="L1201">
.setQuoteMode(QuoteMode.ALL_NON_NULL)</span>
-<span class="fc" id="L1202"> .get();</span>
+<span class="fc" id="L1212"> public static final CSVFormat MYSQL =
DEFAULT.builder()</span>
+<span class="fc" id="L1213"> .setDelimiter(Constants.TAB)</span>
+<span class="fc" id="L1214"> .setEscape(Constants.BACKSLASH)</span>
+<span class="fc" id="L1215"> .setIgnoreEmptyLines(false)</span>
+<span class="fc" id="L1216"> .setQuote(null)</span>
+<span class="fc" id="L1217">
.setRecordSeparator(Constants.LF)</span>
+<span class="fc" id="L1218">
.setNullString(Constants.SQL_NULL_STRING)</span>
+<span class="fc" id="L1219">
.setQuoteMode(QuoteMode.ALL_NON_NULL)</span>
+<span class="fc" id="L1220"> .get();</span>
// @formatter:off
/**
@@ -1212,34 +1230,35 @@ public final class CSVFormat implements
* </p>
*
* <p>
- * The {@link Builder} settings are:
+ * The {@link Builder} settings are the {@link #DEFAULT}
<em>with</em>:
* </p>
* <ul>
- * <li>{@code setDelimiter(',') // default is {@code FIELDS
TERMINATED BY ','}}</li>
- * <li>{@code setEscape('\\')}</li>
- * <li>{@code setIgnoreEmptyLines(false)}</li>
- * <li>{@code setQuote('"') // default is {@code OPTIONALLY
ENCLOSED BY '"'}}</li>
- * <li>{@code setNullString("\\N")}</li>
- * <li>{@code setTrim()}</li>
- * <li>{@code setSystemRecordSeparator()}</li>
- * <li>{@code setQuoteMode(QuoteMode.MINIMAL)}</li>
+ * <li>{@link Builder#setDelimiter(char) setDelimiter}{@code (',')}
// default is {@code FIELDS TERMINATED BY ','}}</li>
+ * <li>{@link Builder#setEscape(char) setEscape}{@code
('\\')}</li>
+ * <li>{@link Builder#setIgnoreEmptyLines(boolean)
setIgnoreEmptyLines}{@code (false)}</li>
+ * <li>{@link Builder#setQuote(char) setQuote}{@code ('"')} //
default is {@code OPTIONALLY ENCLOSED BY '"'}}</li>
+ * <li>{@link Builder#setNullString(String) setNullString}{@code
("\\N")}</li>
+ * <li>{@link Builder#setTrim(boolean) setTrim}{@code
(true)}</li>
+ * <li>{@link Builder#setRecordSeparator(String)
setRecordSeparator}{@code (System.lineSeparator())}</li>
+ * <li>{@link Builder#setQuoteMode(QuoteMode) setQuoteMode}{@code
(QuoteMode.MINIMAL)}</li>
* </ul>
*
* @see Predefined#Oracle
+ * @see QuoteMode#MINIMAL
* @see <a href="https://s.apache.org/CGXG">Oracle CSV
Format Specification</a>
* @since 1.6
*/
// @formatter:off
-<span class="fc" id="L1233"> public static final CSVFormat ORACLE =
DEFAULT.builder()</span>
-<span class="fc" id="L1234"> .setDelimiter(Constants.COMMA)</span>
-<span class="fc" id="L1235"> .setEscape(Constants.BACKSLASH)</span>
-<span class="fc" id="L1236"> .setIgnoreEmptyLines(false)</span>
-<span class="fc" id="L1237">
.setQuote(Constants.DOUBLE_QUOTE_CHAR)</span>
-<span class="fc" id="L1238">
.setNullString(Constants.SQL_NULL_STRING)</span>
-<span class="fc" id="L1239"> .setTrim(true)</span>
-<span class="fc" id="L1240">
.setRecordSeparator(System.lineSeparator())</span>
-<span class="fc" id="L1241"> .setQuoteMode(QuoteMode.MINIMAL)</span>
-<span class="fc" id="L1242"> .get();</span>
+<span class="fc" id="L1252"> public static final CSVFormat ORACLE =
DEFAULT.builder()</span>
+<span class="fc" id="L1253"> .setDelimiter(Constants.COMMA)</span>
+<span class="fc" id="L1254"> .setEscape(Constants.BACKSLASH)</span>
+<span class="fc" id="L1255"> .setIgnoreEmptyLines(false)</span>
+<span class="fc" id="L1256">
.setQuote(Constants.DOUBLE_QUOTE_CHAR)</span>
+<span class="fc" id="L1257">
.setNullString(Constants.SQL_NULL_STRING)</span>
+<span class="fc" id="L1258"> .setTrim(true)</span>
+<span class="fc" id="L1259">
.setRecordSeparator(System.lineSeparator())</span>
+<span class="fc" id="L1260"> .setQuoteMode(QuoteMode.MINIMAL)</span>
+<span class="fc" id="L1261"> .get();</span>
// @formatter:off
/**
@@ -1251,33 +1270,34 @@ public final class CSVFormat implements
* </p>
*
* <p>
- * The {@link Builder} settings are:
+ * The {@link Builder} settings are the {@link #DEFAULT}
<em>with</em>:
* </p>
* <ul>
- * <li>{@code setDelimiter(',')}</li>
- * <li>{@code setEscape(null)}</li>
- * <li>{@code setIgnoreEmptyLines(false)}</li>
- * <li>{@code setQuote('"')}</li>
- * <li>{@code setRecordSeparator('\n')}</li>
- * <li>{@code setNullString("")}</li>
- * <li>{@code setQuoteMode(QuoteMode.ALL_NON_NULL)}</li>
+ * <li>{@link Builder#setDelimiter(char) setDelimiter}{@code
(',')}</li>
+ * <li>{@link Builder#setEscape(Character) setEscape}{@code
(null)}</li>
+ * <li>{@link Builder#setIgnoreEmptyLines(boolean)
setIgnoreEmptyLines}{@code (false)}</li>
+ * <li>{@link Builder#setQuote(char) setQuote}{@code
('"')}</li>
+ * <li>{@link Builder#setRecordSeparator(char)
setRecordSeparator}{@code ('\n')}</li>
+ * <li>{@link Builder#setNullString(String) setNullString}{@code
("")}</li>
+ * <li>{@link Builder#setQuoteMode(QuoteMode) setQuoteMode}{@code
(QuoteMode.ALL_NON_NULL)}</li>
* </ul>
*
* @see Predefined#MySQL
+ * @see QuoteMode#ALL_NON_NULL
* @see <a
href="https://www.postgresql.org/docs/current/static/sql-copy.html">PostgreSQL
COPY command
* documentation</a>
* @since 1.5
*/
// @formatter:off
-<span class="fc" id="L1272"> public static final CSVFormat POSTGRESQL_CSV =
DEFAULT.builder()</span>
-<span class="fc" id="L1273"> .setDelimiter(Constants.COMMA)</span>
-<span class="fc" id="L1274"> .setEscape(null)</span>
-<span class="fc" id="L1275"> .setIgnoreEmptyLines(false)</span>
-<span class="fc" id="L1276">
.setQuote(Constants.DOUBLE_QUOTE_CHAR)</span>
-<span class="fc" id="L1277">
.setRecordSeparator(Constants.LF)</span>
-<span class="fc" id="L1278"> .setNullString(Constants.EMPTY)</span>
-<span class="fc" id="L1279">
.setQuoteMode(QuoteMode.ALL_NON_NULL)</span>
-<span class="fc" id="L1280"> .get();</span>
+<span class="fc" id="L1292"> public static final CSVFormat POSTGRESQL_CSV =
DEFAULT.builder()</span>
+<span class="fc" id="L1293"> .setDelimiter(Constants.COMMA)</span>
+<span class="fc" id="L1294"> .setEscape(null)</span>
+<span class="fc" id="L1295"> .setIgnoreEmptyLines(false)</span>
+<span class="fc" id="L1296">
.setQuote(Constants.DOUBLE_QUOTE_CHAR)</span>
+<span class="fc" id="L1297">
.setRecordSeparator(Constants.LF)</span>
+<span class="fc" id="L1298"> .setNullString(Constants.EMPTY)</span>
+<span class="fc" id="L1299">
.setQuoteMode(QuoteMode.ALL_NON_NULL)</span>
+<span class="fc" id="L1300"> .get();</span>
// @formatter:off
/**
@@ -1289,74 +1309,73 @@ public final class CSVFormat implements
* </p>
*
* <p>
- * The {@link Builder} settings are:
+ * The {@link Builder} settings are the {@link #DEFAULT}
<em>with</em>:
* </p>
* <ul>
- * <li>{@code setDelimiter('\t')}</li>
- * <li>{@code setEscape('\\')}</li>
- * <li>{@code setIgnoreEmptyLines(false)}</li>
- * <li>{@code setQuote(null)}</li>
- * <li>{@code setRecordSeparator('\n')}</li>
- * <li>{@code setNullString("\\N")}</li>
- * <li>{@code setQuoteMode(QuoteMode.ALL_NON_NULL)}</li>
+ * <li>{@link Builder#setDelimiter(char) setDelimiter}{@code
('\t')}</li>
+ * <li>{@link Builder#setEscape(char) setEscape}{@code
('\\')}</li>
+ * <li>{@link Builder#setIgnoreEmptyLines(boolean)
setIgnoreEmptyLines}{@code (false)}</li>
+ * <li>{@link Builder#setQuote(Character) setQuote}{@code
(null)}</li>
+ * <li>{@link Builder#setRecordSeparator(char)
setRecordSeparator}{@code ('\n')}</li>
+ * <li>{@link Builder#setNullString(String) setNullString}{@code
("\\N")}</li>
+ * <li>{@link Builder#setQuoteMode(QuoteMode) setQuoteMode}{@code
(QuoteMode.ALL_NON_NULL)}</li>
* </ul>
*
* @see Predefined#MySQL
+ * @see QuoteMode#ALL_NON_NULL
* @see <a
href="https://www.postgresql.org/docs/current/static/sql-copy.html">PostgreSQL
COPY command
* documentation</a>
* @since 1.5
*/
// @formatter:off
-<span class="fc" id="L1310"> public static final CSVFormat POSTGRESQL_TEXT
= DEFAULT.builder()</span>
-<span class="fc" id="L1311"> .setDelimiter(Constants.TAB)</span>
-<span class="fc" id="L1312"> .setEscape(Constants.BACKSLASH)</span>
-<span class="fc" id="L1313"> .setIgnoreEmptyLines(false)</span>
-<span class="fc" id="L1314"> .setQuote(null)</span>
-<span class="fc" id="L1315">
.setRecordSeparator(Constants.LF)</span>
-<span class="fc" id="L1316">
.setNullString(Constants.SQL_NULL_STRING)</span>
-<span class="fc" id="L1317">
.setQuoteMode(QuoteMode.ALL_NON_NULL)</span>
-<span class="fc" id="L1318"> .get();</span>
+<span class="fc" id="L1331"> public static final CSVFormat POSTGRESQL_TEXT
= DEFAULT.builder()</span>
+<span class="fc" id="L1332"> .setDelimiter(Constants.TAB)</span>
+<span class="fc" id="L1333"> .setEscape(Constants.BACKSLASH)</span>
+<span class="fc" id="L1334"> .setIgnoreEmptyLines(false)</span>
+<span class="fc" id="L1335"> .setQuote(null)</span>
+<span class="fc" id="L1336">
.setRecordSeparator(Constants.LF)</span>
+<span class="fc" id="L1337">
.setNullString(Constants.SQL_NULL_STRING)</span>
+<span class="fc" id="L1338">
.setQuoteMode(QuoteMode.ALL_NON_NULL)</span>
+<span class="fc" id="L1339"> .get();</span>
// @formatter:off
/**
* Comma separated format as defined by <a
href="https://tools.ietf.org/html/rfc4180">RFC 4180</a>.
*
* <p>
- * The {@link Builder} settings are:
+ * The {@link Builder} settings are the {@link #DEFAULT}
<em>with</em>:
* </p>
* <ul>
- * <li>{@code setDelimiter(',')}</li>
- * <li>{@code setQuote('"')}</li>
- * <li>{@code setRecordSeparator("\r\n")}</li>
- * <li>{@code setIgnoreEmptyLines(false)}</li>
+ * <li>{@link Builder#setDelimiter(char) setDelimiter}{@code
(',')}</li>
+ * <li>{@link Builder#setQuote(char) setQuote}{@code
('"')}</li>
+ * <li>{@link Builder#setRecordSeparator(String)
setRecordSeparator}{@code ("\r\n")}</li>
+ * <li>{@link Builder#setIgnoreEmptyLines(boolean)
setIgnoreEmptyLines}{@code (false)}</li>
* </ul>
*
* @see Predefined#RFC4180
*/
-<span class="fc" id="L1336"> public static final CSVFormat RFC4180 =
DEFAULT.builder().setIgnoreEmptyLines(false).get();</span>
+<span class="fc" id="L1357"> public static final CSVFormat RFC4180 =
DEFAULT.builder().setIgnoreEmptyLines(false).get();</span>
private static final long serialVersionUID = 2L;
/**
- * Tab-delimited format.
+ * Tab-delimited format (TDF).
*
* <p>
- * The {@link Builder} settings are:
+ * The {@link Builder} settings are the {@link #DEFAULT}
<em>with</em>:
* </p>
* <ul>
- * <li>{@code setDelimiter('\t')}</li>
- * <li>{@code setQuote('"')}</li>
- * <li>{@code setRecordSeparator("\r\n")}</li>
- * <li>{@code setIgnoreSurroundingSpaces(true)}</li>
+ * <li>{@link Builder#setDelimiter(char) setDelimiter}{@code
('\t')}</li>
+ * <li>{@link Builder#setIgnoreSurroundingSpaces(boolean)
setIgnoreSurroundingSpaces}{@code (true)}</li>
* </ul>
*
* @see Predefined#TDF
*/
// @formatter:off
-<span class="fc" id="L1356"> public static final CSVFormat TDF =
DEFAULT.builder()</span>
-<span class="fc" id="L1357"> .setDelimiter(Constants.TAB)</span>
-<span class="fc" id="L1358">
.setIgnoreSurroundingSpaces(true)</span>
-<span class="fc" id="L1359"> .get();</span>
+<span class="fc" id="L1375"> public static final CSVFormat TDF =
DEFAULT.builder()</span>
+<span class="fc" id="L1376"> .setDelimiter(Constants.TAB)</span>
+<span class="fc" id="L1377">
.setIgnoreSurroundingSpaces(true)</span>
+<span class="fc" id="L1378"> .get();</span>
// @formatter:on
/**
@@ -1368,7 +1387,7 @@ public final class CSVFormat implements
*/
@SafeVarargs
static <T> T[] clone(final T... values) {
-<span class="fc bfc" id="L1371" title="All 2 branches covered."> return
values == null ? null : values.clone();</span>
+<span class="fc bfc" id="L1390" title="All 2 branches covered."> return
values == null ? null : values.clone();</span>
}
/**
@@ -1379,7 +1398,7 @@ public final class CSVFormat implements
* @return true if {@code c} contains a line break character
*/
private static boolean contains(final String source, final char searchCh) {
-<span class="fc bfc" id="L1382" title="All 2 branches covered."> return
Objects.requireNonNull(source, "source").indexOf(searchCh) >=
0;</span>
+<span class="fc bfc" id="L1401" title="All 2 branches covered."> return
Objects.requireNonNull(source, "source").indexOf(searchCh) >=
0;</span>
}
/**
@@ -1389,7 +1408,7 @@ public final class CSVFormat implements
* @return true if {@code c} contains a line break character.
*/
private static boolean containsLineBreak(final String source) {
-<span class="fc bfc" id="L1392" title="All 4 branches covered."> return
contains(source, Constants.CR) || contains(source, Constants.LF);</span>
+<span class="fc bfc" id="L1411" title="All 4 branches covered."> return
contains(source, Constants.CR) || contains(source, Constants.LF);</span>
}
/**
@@ -1398,11 +1417,11 @@ public final class CSVFormat implements
* @return a copy of the given instance or null if the input is null.
*/
static CSVFormat copy(final CSVFormat format) {
-<span class="pc bpc" id="L1401" title="1 of 2 branches missed."> return
format != null ? format.copy() : null;</span>
+<span class="pc bpc" id="L1420" title="1 of 2 branches missed."> return
format != null ? format.copy() : null;</span>
}
static boolean isBlank(final String value) {
-<span class="fc bfc" id="L1405" title="All 4 branches covered."> return
value == null || value.trim().isEmpty();</span>
+<span class="fc bfc" id="L1424" title="All 4 branches covered."> return
value == null || value.trim().isEmpty();</span>
}
/**
@@ -1412,7 +1431,7 @@ public final class CSVFormat implements
* @return true if {@code c} is a line break character.
*/
private static boolean isLineBreak(final char c) {
-<span class="fc bfc" id="L1415" title="All 4 branches covered."> return
c == Constants.LF || c == Constants.CR;</span>
+<span class="fc bfc" id="L1434" title="All 4 branches covered."> return
c == Constants.LF || c == Constants.CR;</span>
}
/**
@@ -1422,17 +1441,17 @@ public final class CSVFormat implements
* @return true if {@code c} is a line break character (and not null).
*/
private static boolean isLineBreak(final Character c) {
-<span class="fc bfc" id="L1425" title="All 4 branches covered."> return
c != null && isLineBreak(c.charValue()); // N.B. Explicit (un)boxing is
intentional</span>
+<span class="fc bfc" id="L1444" title="All 4 branches covered."> return
c != null && isLineBreak(c.charValue()); // N.B. Explicit (un)boxing is
intentional</span>
}
/** Same test as in as {@link String#trim()}. */
private static boolean isTrimChar(final char ch) {
-<span class="fc bfc" id="L1430" title="All 2 branches covered."> return
ch <= Constants.SP;</span>
+<span class="fc bfc" id="L1449" title="All 2 branches covered."> return
ch <= Constants.SP;</span>
}
/** Same test as in as {@link String#trim()}. */
private static boolean isTrimChar(final CharSequence charSequence, final
int pos) {
-<span class="fc" id="L1435"> return
isTrimChar(charSequence.charAt(pos));</span>
+<span class="fc" id="L1454"> return
isTrimChar(charSequence.charAt(pos));</span>
}
/**
@@ -1452,33 +1471,33 @@ public final class CSVFormat implements
* @see #TDF
*/
public static CSVFormat newFormat(final char delimiter) {
-<span class="fc" id="L1455"> return new CSVFormat(new
Builder().setDelimiter(delimiter));</span>
+<span class="fc" id="L1474"> return new CSVFormat(new
Builder().setDelimiter(delimiter));</span>
}
static String[] toStringArray(final Object[] values) {
-<span class="fc bfc" id="L1459" title="All 2 branches covered."> if
(values == null) {</span>
-<span class="fc" id="L1460"> return null;</span>
+<span class="fc bfc" id="L1478" title="All 2 branches covered."> if
(values == null) {</span>
+<span class="fc" id="L1479"> return null;</span>
}
-<span class="fc" id="L1462"> final String[] strings = new
String[values.length];</span>
-<span class="fc" id="L1463"> Arrays.setAll(strings, i ->
Objects.toString(values[i], null));</span>
-<span class="fc" id="L1464"> return strings;</span>
+<span class="fc" id="L1481"> final String[] strings = new
String[values.length];</span>
+<span class="fc" id="L1482"> Arrays.setAll(strings, i ->
Objects.toString(values[i], null));</span>
+<span class="fc" id="L1483"> return strings;</span>
}
static CharSequence trim(final CharSequence charSequence) {
-<span class="fc bfc" id="L1468" title="All 2 branches covered."> if
(charSequence instanceof String) {</span>
-<span class="fc" id="L1469"> return ((String)
charSequence).trim();</span>
+<span class="fc bfc" id="L1487" title="All 2 branches covered."> if
(charSequence instanceof String) {</span>
+<span class="fc" id="L1488"> return ((String)
charSequence).trim();</span>
}
-<span class="fc" id="L1471"> final int count =
charSequence.length();</span>
-<span class="fc" id="L1472"> int len = count;</span>
-<span class="fc" id="L1473"> int pos = 0;</span>
+<span class="fc" id="L1490"> final int count =
charSequence.length();</span>
+<span class="fc" id="L1491"> int len = count;</span>
+<span class="fc" id="L1492"> int pos = 0;</span>
-<span class="fc bfc" id="L1475" title="All 4 branches covered."> while
(pos < len && isTrimChar(charSequence, pos)) {</span>
-<span class="fc" id="L1476"> pos++;</span>
+<span class="fc bfc" id="L1494" title="All 4 branches covered."> while
(pos < len && isTrimChar(charSequence, pos)) {</span>
+<span class="fc" id="L1495"> pos++;</span>
}
-<span class="fc bfc" id="L1478" title="All 4 branches covered."> while
(pos < len && isTrimChar(charSequence, len - 1)) {</span>
-<span class="fc" id="L1479"> len--;</span>
+<span class="fc bfc" id="L1497" title="All 4 branches covered."> while
(pos < len && isTrimChar(charSequence, len - 1)) {</span>
+<span class="fc" id="L1498"> len--;</span>
}
-<span class="fc bfc" id="L1481" title="All 4 branches covered."> return
pos > 0 || len < count ? charSequence.subSequence(pos, len) :
charSequence;</span>
+<span class="fc bfc" id="L1500" title="All 4 branches covered."> return
pos > 0 || len < count ? charSequence.subSequence(pos, len) :
charSequence;</span>
}
/**
@@ -1489,7 +1508,7 @@ public final class CSVFormat implements
* @since 1.2
*/
public static CSVFormat valueOf(final String format) {
-<span class="fc" id="L1492"> return
CSVFormat.Predefined.valueOf(format).getFormat();</span>
+<span class="fc" id="L1511"> return
CSVFormat.Predefined.valueOf(format).getFormat();</span>
}
/** How duplicate headers are handled. */
@@ -1555,46 +1574,46 @@ public final class CSVFormat implements
/** Whether to trim leading and trailing blanks. */
private final boolean trim;
-<span class="fc" id="L1558"> private CSVFormat(final Builder builder)
{</span>
-<span class="fc" id="L1559"> this.delimiter = builder.delimiter;</span>
-<span class="fc" id="L1560"> this.quoteCharacter =
builder.quoteCharacter;</span>
-<span class="fc" id="L1561"> this.quoteMode = builder.quoteMode;</span>
-<span class="fc" id="L1562"> this.commentMarker =
builder.commentMarker;</span>
-<span class="fc" id="L1563"> this.escapeCharacter =
builder.escapeCharacter;</span>
-<span class="fc" id="L1564"> this.ignoreSurroundingSpaces =
builder.ignoreSurroundingSpaces;</span>
-<span class="fc" id="L1565"> this.allowMissingColumnNames =
builder.allowMissingColumnNames;</span>
-<span class="fc" id="L1566"> this.ignoreEmptyLines =
builder.ignoreEmptyLines;</span>
-<span class="fc" id="L1567"> this.recordSeparator =
builder.recordSeparator;</span>
-<span class="fc" id="L1568"> this.nullString =
builder.nullString;</span>
-<span class="fc" id="L1569"> this.headerComments =
builder.headerComments;</span>
-<span class="fc" id="L1570"> this.headers = builder.headers;</span>
-<span class="fc" id="L1571"> this.skipHeaderRecord =
builder.skipHeaderRecord;</span>
-<span class="fc" id="L1572"> this.ignoreHeaderCase =
builder.ignoreHeaderCase;</span>
-<span class="fc" id="L1573"> this.lenientEof =
builder.lenientEof;</span>
-<span class="fc" id="L1574"> this.trailingData =
builder.trailingData;</span>
-<span class="fc" id="L1575"> this.trailingDelimiter =
builder.trailingDelimiter;</span>
-<span class="fc" id="L1576"> this.trim = builder.trim;</span>
-<span class="fc" id="L1577"> this.autoFlush = builder.autoFlush;</span>
-<span class="fc" id="L1578"> this.quotedNullString =
builder.quotedNullString;</span>
-<span class="fc" id="L1579"> this.duplicateHeaderMode =
builder.duplicateHeaderMode;</span>
-<span class="fc" id="L1580"> validate();</span>
-<span class="fc" id="L1581"> }</span>
+<span class="fc" id="L1577"> private CSVFormat(final Builder builder)
{</span>
+<span class="fc" id="L1578"> this.delimiter = builder.delimiter;</span>
+<span class="fc" id="L1579"> this.quoteCharacter =
builder.quoteCharacter;</span>
+<span class="fc" id="L1580"> this.quoteMode = builder.quoteMode;</span>
+<span class="fc" id="L1581"> this.commentMarker =
builder.commentMarker;</span>
+<span class="fc" id="L1582"> this.escapeCharacter =
builder.escapeCharacter;</span>
+<span class="fc" id="L1583"> this.ignoreSurroundingSpaces =
builder.ignoreSurroundingSpaces;</span>
+<span class="fc" id="L1584"> this.allowMissingColumnNames =
builder.allowMissingColumnNames;</span>
+<span class="fc" id="L1585"> this.ignoreEmptyLines =
builder.ignoreEmptyLines;</span>
+<span class="fc" id="L1586"> this.recordSeparator =
builder.recordSeparator;</span>
+<span class="fc" id="L1587"> this.nullString =
builder.nullString;</span>
+<span class="fc" id="L1588"> this.headerComments =
builder.headerComments;</span>
+<span class="fc" id="L1589"> this.headers = builder.headers;</span>
+<span class="fc" id="L1590"> this.skipHeaderRecord =
builder.skipHeaderRecord;</span>
+<span class="fc" id="L1591"> this.ignoreHeaderCase =
builder.ignoreHeaderCase;</span>
+<span class="fc" id="L1592"> this.lenientEof =
builder.lenientEof;</span>
+<span class="fc" id="L1593"> this.trailingData =
builder.trailingData;</span>
+<span class="fc" id="L1594"> this.trailingDelimiter =
builder.trailingDelimiter;</span>
+<span class="fc" id="L1595"> this.trim = builder.trim;</span>
+<span class="fc" id="L1596"> this.autoFlush = builder.autoFlush;</span>
+<span class="fc" id="L1597"> this.quotedNullString =
builder.quotedNullString;</span>
+<span class="fc" id="L1598"> this.duplicateHeaderMode =
builder.duplicateHeaderMode;</span>
+<span class="fc" id="L1599"> validate();</span>
+<span class="fc" id="L1600"> }</span>
private void append(final char c, final Appendable appendable) throws
IOException {
// try {
-<span class="fc" id="L1585"> appendable.append(c);</span>
+<span class="fc" id="L1604"> appendable.append(c);</span>
// } catch (final IOException e) {
// throw new UncheckedIOException(e);
// }
-<span class="fc" id="L1589"> }</span>
+<span class="fc" id="L1608"> }</span>
private void append(final CharSequence csq, final Appendable appendable)
throws IOException {
// try {
-<span class="fc" id="L1593"> appendable.append(csq);</span>
+<span class="fc" id="L1612"> appendable.append(csq);</span>
// } catch (final IOException e) {
// throw new UncheckedIOException(e);
// }
-<span class="fc" id="L1597"> }</span>
+<span class="fc" id="L1616"> }</span>
/**
* Creates a new Builder for this instance.
@@ -1602,7 +1621,7 @@ public final class CSVFormat implements
* @return a new Builder.
*/
public Builder builder() {
-<span class="fc" id="L1605"> return Builder.create(this);</span>
+<span class="fc" id="L1624"> return Builder.create(this);</span>
}
/**
@@ -1611,37 +1630,37 @@ public final class CSVFormat implements
* @return a copy of this instance.
*/
CSVFormat copy() {
-<span class="fc" id="L1614"> return builder().get();</span>
+<span class="fc" id="L1633"> return builder().get();</span>
}
@Override
public boolean equals(final Object obj) {
-<span class="fc bfc" id="L1619" title="All 2 branches covered."> if
(this == obj) {</span>
-<span class="fc" id="L1620"> return true;</span>
+<span class="fc bfc" id="L1638" title="All 2 branches covered."> if
(this == obj) {</span>
+<span class="fc" id="L1639"> return true;</span>
}
-<span class="fc bfc" id="L1622" title="All 2 branches covered."> if
(obj == null) {</span>
-<span class="fc" id="L1623"> return false;</span>
+<span class="fc bfc" id="L1641" title="All 2 branches covered."> if
(obj == null) {</span>
+<span class="fc" id="L1642"> return false;</span>
}
-<span class="fc bfc" id="L1625" title="All 2 branches covered."> if
(getClass() != obj.getClass()) {</span>
-<span class="fc" id="L1626"> return false;</span>
+<span class="fc bfc" id="L1644" title="All 2 branches covered."> if
(getClass() != obj.getClass()) {</span>
+<span class="fc" id="L1645"> return false;</span>
}
-<span class="fc" id="L1628"> final CSVFormat other = (CSVFormat)
obj;</span>
-<span class="fc bfc" id="L1629" title="All 4 branches covered."> return
allowMissingColumnNames == other.allowMissingColumnNames && autoFlush
== other.autoFlush &&</span>
-<span class="fc bfc" id="L1630" title="All 6 branches covered.">
Objects.equals(commentMarker, other.commentMarker) &&
Objects.equals(delimiter, other.delimiter) &&</span>
-<span class="fc bfc" id="L1631" title="All 2 branches covered.">
duplicateHeaderMode == other.duplicateHeaderMode &&
Objects.equals(escapeCharacter, other.escapeCharacter) &&</span>
-<span class="pc bpc" id="L1632" title="1 of 12 branches missed.">
Arrays.equals(headerComments, other.headerComments) &&
Arrays.equals(headers, other.headers) &&</span>
+<span class="fc" id="L1647"> final CSVFormat other = (CSVFormat)
obj;</span>
+<span class="fc bfc" id="L1648" title="All 4 branches covered."> return
allowMissingColumnNames == other.allowMissingColumnNames && autoFlush
== other.autoFlush &&</span>
+<span class="fc bfc" id="L1649" title="All 6 branches covered.">
Objects.equals(commentMarker, other.commentMarker) &&
Objects.equals(delimiter, other.delimiter) &&</span>
+<span class="fc bfc" id="L1650" title="All 2 branches covered.">
duplicateHeaderMode == other.duplicateHeaderMode &&
Objects.equals(escapeCharacter, other.escapeCharacter) &&</span>
+<span class="pc bpc" id="L1651" title="1 of 12 branches missed.">
Arrays.equals(headerComments, other.headerComments) &&
Arrays.equals(headers, other.headers) &&</span>
ignoreEmptyLines == other.ignoreEmptyLines &&
ignoreHeaderCase == other.ignoreHeaderCase &&
ignoreSurroundingSpaces == other.ignoreSurroundingSpaces
&& lenientEof == other.lenientEof &&
-<span class="fc bfc" id="L1635" title="All 6 branches covered.">
Objects.equals(nullString, other.nullString) &&
Objects.equals(quoteCharacter, other.quoteCharacter) &&</span>
-<span class="pc bpc" id="L1636" title="1 of 2 branches missed.">
quoteMode == other.quoteMode && Objects.equals(quotedNullString,
other.quotedNullString) &&</span>
-<span class="pc bpc" id="L1637" title="1 of 10 branches missed.">
Objects.equals(recordSeparator, other.recordSeparator) &&
skipHeaderRecord == other.skipHeaderRecord &&</span>
+<span class="fc bfc" id="L1654" title="All 6 branches covered.">
Objects.equals(nullString, other.nullString) &&
Objects.equals(quoteCharacter, other.quoteCharacter) &&</span>
+<span class="pc bpc" id="L1655" title="1 of 2 branches missed.">
quoteMode == other.quoteMode && Objects.equals(quotedNullString,
other.quotedNullString) &&</span>
+<span class="pc bpc" id="L1656" title="1 of 10 branches missed.">
Objects.equals(recordSeparator, other.recordSeparator) &&
skipHeaderRecord == other.skipHeaderRecord &&</span>
trailingData == other.trailingData &&
trailingDelimiter == other.trailingDelimiter && trim == other.trim;
}
private void escape(final char c, final Appendable appendable) throws
IOException {
-<span class="fc" id="L1642"> append(escapeCharacter.charValue(),
appendable); // N.B. Explicit (un)boxing is intentional</span>
-<span class="fc" id="L1643"> append(c, appendable);</span>
-<span class="fc" id="L1644"> }</span>
+<span class="fc" id="L1661"> append(escapeCharacter.charValue(),
appendable); // N.B. Explicit (un)boxing is intentional</span>
+<span class="fc" id="L1662"> append(c, appendable);</span>
+<span class="fc" id="L1663"> }</span>
/**
* Formats the specified values.
@@ -1650,16 +1669,16 @@ public final class CSVFormat implements
* @return the formatted values
*/
public String format(final Object... values) {
-<span class="fc" id="L1653"> return Uncheck.get(() ->
format_(values));</span>
+<span class="fc" id="L1672"> return Uncheck.get(() ->
format_(values));</span>
}
private String format_(final Object... values) throws IOException {
-<span class="fc" id="L1657"> final StringWriter out = new
StringWriter();</span>
-<span class="fc" id="L1658"> try (CSVPrinter csvPrinter = new
CSVPrinter(out, this)) {</span>
-<span class="fc" id="L1659"> csvPrinter.printRecord(values);</span>
-<span class="fc" id="L1660"> final String res =
out.toString();</span>
-<span class="fc bfc" id="L1661" title="All 2 branches covered.">
final int len = recordSeparator != null ? res.length() -
recordSeparator.length() : res.length();</span>
-<span class="fc" id="L1662"> return res.substring(0, len);</span>
+<span class="fc" id="L1676"> final StringWriter out = new
StringWriter();</span>
+<span class="fc" id="L1677"> try (CSVPrinter csvPrinter = new
CSVPrinter(out, this)) {</span>
+<span class="fc" id="L1678"> csvPrinter.printRecord(values);</span>
+<span class="fc" id="L1679"> final String res =
out.toString();</span>
+<span class="fc bfc" id="L1680" title="All 2 branches covered.">
final int len = recordSeparator != null ? res.length() -
recordSeparator.length() : res.length();</span>
+<span class="fc" id="L1681"> return res.substring(0, len);</span>
}
}
@@ -1672,7 +1691,7 @@ public final class CSVFormat implements
*/
@Deprecated
public boolean getAllowDuplicateHeaderNames() {
-<span class="fc bfc" id="L1675" title="All 2 branches covered."> return
duplicateHeaderMode == DuplicateHeaderMode.ALLOW_ALL;</span>
+<span class="fc bfc" id="L1694" title="All 2 branches covered."> return
duplicateHeaderMode == DuplicateHeaderMode.ALLOW_ALL;</span>
}
/**
@@ -1681,7 +1700,7 @@ public final class CSVFormat implements
* @return {@code true} if missing column names are allowed when parsing
the header line, {@code false} to throw an {@link IllegalArgumentException}.
*/
public boolean getAllowMissingColumnNames() {
-<span class="fc" id="L1684"> return allowMissingColumnNames;</span>
+<span class="fc" id="L1703"> return allowMissingColumnNames;</span>
}
/**
@@ -1691,7 +1710,7 @@ public final class CSVFormat implements
* @since 1.6
*/
public boolean getAutoFlush() {
-<span class="fc" id="L1694"> return autoFlush;</span>
+<span class="fc" id="L1713"> return autoFlush;</span>
}
/**
@@ -1728,7 +1747,7 @@ public final class CSVFormat implements
* @return the comment start marker, may be {@code null}
*/
public Character getCommentMarker() {
-<span class="fc" id="L1731"> return commentMarker;</span>
+<span class="fc" id="L1750"> return commentMarker;</span>
}
/**
@@ -1739,7 +1758,7 @@ public final class CSVFormat implements
*/
@Deprecated
public char getDelimiter() {
-<span class="fc" id="L1742"> return delimiter.charAt(0);</span>
+<span class="fc" id="L1761"> return delimiter.charAt(0);</span>
}
/**
@@ -1748,7 +1767,7 @@ public final class CSVFormat implements
* @return the delimiter.
*/
char[] getDelimiterCharArray() {
-<span class="fc" id="L1751"> return delimiter.toCharArray();</span>
+<span class="fc" id="L1770"> return delimiter.toCharArray();</span>
}
/**
@@ -1758,7 +1777,7 @@ public final class CSVFormat implements
* @since 1.9.0
*/
public String getDelimiterString() {
-<span class="fc" id="L1761"> return delimiter;</span>
+<span class="fc" id="L1780"> return delimiter;</span>
}
/**
@@ -1768,7 +1787,7 @@ public final class CSVFormat implements
* @since 1.10.0
*/
public DuplicateHeaderMode getDuplicateHeaderMode() {
-<span class="fc" id="L1771"> return duplicateHeaderMode;</span>
+<span class="fc" id="L1790"> return duplicateHeaderMode;</span>
}
/**
@@ -1777,7 +1796,7 @@ public final class CSVFormat implements
* @return the escape character, may be {@code 0}
*/
char getEscapeChar() {
-<span class="pc bpc" id="L1780" title="1 of 2 branches missed."> return
escapeCharacter != null ? escapeCharacter.charValue() : 0; // N.B. Explicit
(un)boxing is intentional</span>
+<span class="pc bpc" id="L1799" title="1 of 2 branches missed."> return
escapeCharacter != null ? escapeCharacter.charValue() : 0; // N.B. Explicit
(un)boxing is intentional</span>
}
/**
@@ -1786,7 +1805,7 @@ public final class CSVFormat implements
* @return the escape character, may be {@code null}
*/
public Character getEscapeCharacter() {
-<span class="fc" id="L1789"> return escapeCharacter;</span>
+<span class="fc" id="L1808"> return escapeCharacter;</span>
}
/**
@@ -1795,7 +1814,7 @@ public final class CSVFormat implements
* @return a copy of the header array; {@code null} if disabled, the empty
array if to be read from the file
*/
public String[] getHeader() {
-<span class="fc bfc" id="L1798" title="All 2 branches covered."> return
headers != null ? headers.clone() : null;</span>
+<span class="fc bfc" id="L1817" title="All 2 branches covered."> return
headers != null ? headers.clone() : null;</span>
}
/**
@@ -1832,7 +1851,7 @@ public final class CSVFormat implements
* @return a copy of the header comment array; {@code null} if disabled.
*/
public String[] getHeaderComments() {
-<span class="fc bfc" id="L1835" title="All 2 branches covered."> return
headerComments != null ? headerComments.clone() : null;</span>
+<span class="fc bfc" id="L1854" title="All 2 branches covered."> return
headerComments != null ? headerComments.clone() : null;</span>
}
/**
@@ -1841,7 +1860,7 @@ public final class CSVFormat implements
* @return {@code true} if empty lines between records are ignored, {@code
false} if they are turned into empty records.
*/
public boolean getIgnoreEmptyLines() {
-<span class="fc" id="L1844"> return ignoreEmptyLines;</span>
+<span class="fc" id="L1863"> return ignoreEmptyLines;</span>
}
/**
@@ -1851,7 +1870,7 @@ public final class CSVFormat implements
* @since 1.3
*/
public boolean getIgnoreHeaderCase() {
-<span class="fc" id="L1854"> return ignoreHeaderCase;</span>
+<span class="fc" id="L1873"> return ignoreHeaderCase;</span>
}
/**
@@ -1860,7 +1879,7 @@ public final class CSVFormat implements
* @return {@code true} if spaces around values are ignored, {@code false}
if they are treated as part of the value.
*/
public boolean getIgnoreSurroundingSpaces() {
-<span class="fc" id="L1863"> return ignoreSurroundingSpaces;</span>
+<span class="fc" id="L1882"> return ignoreSurroundingSpaces;</span>
}
/**
@@ -1870,7 +1889,7 @@ public final class CSVFormat implements
* @since 1.11.0
*/
public boolean getLenientEof() {
-<span class="fc" id="L1873"> return lenientEof;</span>
+<span class="fc" id="L1892"> return lenientEof;</span>
}
/**
@@ -1883,7 +1902,7 @@ public final class CSVFormat implements
* @return the String to convert to and from {@code null}. No substitution
occurs if {@code null}
*/
public String getNullString() {
-<span class="fc" id="L1886"> return nullString;</span>
+<span class="fc" id="L1905"> return nullString;</span>
}
/**
@@ -1892,7 +1911,7 @@ public final class CSVFormat implements
* @return the quoteChar character, may be {@code null}
*/
public Character getQuoteCharacter() {
-<span class="fc" id="L1895"> return quoteCharacter;</span>
+<span class="fc" id="L1914"> return quoteCharacter;</span>
}
/**
[... 1196 lines stripped ...]