Sort members.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1739672 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ad38b2d28b
commit
a4c1a85d9d
|
@ -195,23 +195,6 @@ public final class CSVFormat implements Serializable {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private final char delimiter;
|
|
||||||
private final Character quoteCharacter; // null if quoting is disabled
|
|
||||||
private final QuoteMode quoteMode;
|
|
||||||
private final Character commentMarker; // null if commenting is disabled
|
|
||||||
private final Character escapeCharacter; // null if escaping is disabled
|
|
||||||
private final boolean ignoreSurroundingSpaces; // Should leading/trailing spaces be ignored around values?
|
|
||||||
private final boolean allowMissingColumnNames;
|
|
||||||
private final boolean ignoreEmptyLines;
|
|
||||||
private final String recordSeparator; // for outputs
|
|
||||||
private final String nullString; // the string to be used for null values
|
|
||||||
private final String[] header; // array of header column names
|
|
||||||
private final String[] headerComments; // array of header comment lines
|
|
||||||
private final boolean skipHeaderRecord;
|
|
||||||
private final boolean ignoreHeaderCase; // should ignore header names case
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Standard comma separated format, as for {@link #RFC4180} but allowing empty lines.
|
* Standard comma separated format, as for {@link #RFC4180} but allowing empty lines.
|
||||||
*
|
*
|
||||||
|
@ -229,22 +212,6 @@ public final class CSVFormat implements Serializable {
|
||||||
public static final CSVFormat DEFAULT = new CSVFormat(COMMA, DOUBLE_QUOTE_CHAR, null, null, null, false, true,
|
public static final CSVFormat DEFAULT = new CSVFormat(COMMA, DOUBLE_QUOTE_CHAR, null, null, null, false, true,
|
||||||
CRLF, null, null, null, false, false, false);
|
CRLF, null, null, null, false, false, false);
|
||||||
|
|
||||||
/**
|
|
||||||
* Comma separated format as defined by <a href="http://tools.ietf.org/html/rfc4180">RFC 4180</a>.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* Settings are:
|
|
||||||
* </p>
|
|
||||||
* <ul>
|
|
||||||
* <li>withDelimiter(',')</li>
|
|
||||||
* <li>withQuote('"')</li>
|
|
||||||
* <li>withRecordSeparator("\r\n")</li>
|
|
||||||
* <li>withIgnoreEmptyLines(false)</li>
|
|
||||||
* </ul>
|
|
||||||
* @see Predefined#RFC4180
|
|
||||||
*/
|
|
||||||
public static final CSVFormat RFC4180 = DEFAULT.withIgnoreEmptyLines(false);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Excel file format (using a comma as the value delimiter). Note that the actual value delimiter used by Excel is
|
* 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 to customize this format to accommodate to your regional settings.
|
* locale dependent, it might be necessary to customize this format to accommodate to your regional settings.
|
||||||
|
@ -274,23 +241,6 @@ public final class CSVFormat implements Serializable {
|
||||||
* @see Predefined#Excel
|
* @see Predefined#Excel
|
||||||
*/
|
*/
|
||||||
public static final CSVFormat EXCEL = DEFAULT.withIgnoreEmptyLines(false).withAllowMissingColumnNames();
|
public static final CSVFormat EXCEL = DEFAULT.withIgnoreEmptyLines(false).withAllowMissingColumnNames();
|
||||||
|
|
||||||
/**
|
|
||||||
* Tab-delimited format.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* Settings are:
|
|
||||||
* </p>
|
|
||||||
* <ul>
|
|
||||||
* <li>withDelimiter('\t')</li>
|
|
||||||
* <li>withQuote('"')</li>
|
|
||||||
* <li>withRecordSeparator("\r\n")</li>
|
|
||||||
* <li>withIgnoreSurroundingSpaces(true)</li>
|
|
||||||
* </ul>
|
|
||||||
* @see Predefined#TDF
|
|
||||||
*/
|
|
||||||
public static final CSVFormat TDF = DEFAULT.withDelimiter(TAB).withIgnoreSurroundingSpaces();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default MySQL format used by the {@code SELECT INTO OUTFILE} and {@code LOAD DATA INFILE} operations.
|
* Default MySQL format used by the {@code SELECT INTO OUTFILE} and {@code LOAD DATA INFILE} operations.
|
||||||
*
|
*
|
||||||
|
@ -317,7 +267,37 @@ public final class CSVFormat implements Serializable {
|
||||||
*/
|
*/
|
||||||
public static final CSVFormat MYSQL = DEFAULT.withDelimiter(TAB).withEscape(BACKSLASH).withIgnoreEmptyLines(false)
|
public static final CSVFormat MYSQL = DEFAULT.withDelimiter(TAB).withEscape(BACKSLASH).withIgnoreEmptyLines(false)
|
||||||
.withQuote(null).withRecordSeparator(LF).withNullString("\\N");
|
.withQuote(null).withRecordSeparator(LF).withNullString("\\N");
|
||||||
|
/**
|
||||||
|
* Comma separated format as defined by <a href="http://tools.ietf.org/html/rfc4180">RFC 4180</a>.
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* Settings are:
|
||||||
|
* </p>
|
||||||
|
* <ul>
|
||||||
|
* <li>withDelimiter(',')</li>
|
||||||
|
* <li>withQuote('"')</li>
|
||||||
|
* <li>withRecordSeparator("\r\n")</li>
|
||||||
|
* <li>withIgnoreEmptyLines(false)</li>
|
||||||
|
* </ul>
|
||||||
|
* @see Predefined#RFC4180
|
||||||
|
*/
|
||||||
|
public static final CSVFormat RFC4180 = DEFAULT.withIgnoreEmptyLines(false);
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
/**
|
||||||
|
* Tab-delimited format.
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* Settings are:
|
||||||
|
* </p>
|
||||||
|
* <ul>
|
||||||
|
* <li>withDelimiter('\t')</li>
|
||||||
|
* <li>withQuote('"')</li>
|
||||||
|
* <li>withRecordSeparator("\r\n")</li>
|
||||||
|
* <li>withIgnoreSurroundingSpaces(true)</li>
|
||||||
|
* </ul>
|
||||||
|
* @see Predefined#TDF
|
||||||
|
*/
|
||||||
|
public static final CSVFormat TDF = DEFAULT.withDelimiter(TAB).withIgnoreSurroundingSpaces();
|
||||||
/**
|
/**
|
||||||
* Returns true if the given character is a line break character.
|
* Returns true if the given character is a line break character.
|
||||||
*
|
*
|
||||||
|
@ -329,7 +309,6 @@ public final class CSVFormat implements Serializable {
|
||||||
private static boolean isLineBreak(final char c) {
|
private static boolean isLineBreak(final char c) {
|
||||||
return c == LF || c == CR;
|
return c == LF || c == CR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the given character is a line break character.
|
* Returns true if the given character is a line break character.
|
||||||
*
|
*
|
||||||
|
@ -341,7 +320,6 @@ public final class CSVFormat implements Serializable {
|
||||||
private static boolean isLineBreak(final Character c) {
|
private static boolean isLineBreak(final Character c) {
|
||||||
return c != null && isLineBreak(c.charValue());
|
return c != null && isLineBreak(c.charValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new CSV format with the specified delimiter.
|
* Creates a new CSV format with the specified delimiter.
|
||||||
*
|
*
|
||||||
|
@ -365,7 +343,6 @@ public final class CSVFormat implements Serializable {
|
||||||
public static CSVFormat newFormat(final char delimiter) {
|
public static CSVFormat newFormat(final char delimiter) {
|
||||||
return new CSVFormat(delimiter, null, null, null, null, false, false, null, null, null, null, false, false, false);
|
return new CSVFormat(delimiter, null, null, null, null, false, false, null, null, null, null, false, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets one of the predefined formats from {@link CSVFormat.Predefined}.
|
* Gets one of the predefined formats from {@link CSVFormat.Predefined}.
|
||||||
*
|
*
|
||||||
|
@ -377,6 +354,29 @@ public final class CSVFormat implements Serializable {
|
||||||
public static CSVFormat valueOf(final String format) {
|
public static CSVFormat valueOf(final String format) {
|
||||||
return CSVFormat.Predefined.valueOf(format).getFormat();
|
return CSVFormat.Predefined.valueOf(format).getFormat();
|
||||||
}
|
}
|
||||||
|
private final boolean allowMissingColumnNames;
|
||||||
|
private final Character commentMarker; // null if commenting is disabled
|
||||||
|
private final char delimiter;
|
||||||
|
private final Character escapeCharacter; // null if escaping is disabled
|
||||||
|
private final String[] header; // array of header column names
|
||||||
|
|
||||||
|
private final String[] headerComments; // array of header comment lines
|
||||||
|
|
||||||
|
private final boolean ignoreEmptyLines;
|
||||||
|
|
||||||
|
private final boolean ignoreHeaderCase; // should ignore header names case
|
||||||
|
|
||||||
|
private final boolean ignoreSurroundingSpaces; // Should leading/trailing spaces be ignored around values?
|
||||||
|
|
||||||
|
private final String nullString; // the string to be used for null values
|
||||||
|
|
||||||
|
private final Character quoteCharacter; // null if quoting is disabled
|
||||||
|
|
||||||
|
private final QuoteMode quoteMode;
|
||||||
|
|
||||||
|
private final String recordSeparator; // for outputs
|
||||||
|
|
||||||
|
private final boolean skipHeaderRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a customized CSV format.
|
* Creates a customized CSV format.
|
||||||
|
@ -434,18 +434,6 @@ public final class CSVFormat implements Serializable {
|
||||||
validate();
|
validate();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String[] toStringArray(final Object[] values) {
|
|
||||||
if (values == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
final String[] strings = new String[values.length];
|
|
||||||
for (int i = 0; i < values.length; i++) {
|
|
||||||
final Object value = values[i];
|
|
||||||
strings[i] = value == null ? null : value.toString();
|
|
||||||
}
|
|
||||||
return strings;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object obj) {
|
public boolean equals(final Object obj) {
|
||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
|
@ -533,6 +521,16 @@ public final class CSVFormat implements Serializable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies whether missing column names are allowed when parsing the header line.
|
||||||
|
*
|
||||||
|
* @return {@code true} if missing column names are allowed when parsing the header line, {@code false} to throw an
|
||||||
|
* {@link IllegalArgumentException}.
|
||||||
|
*/
|
||||||
|
public boolean getAllowMissingColumnNames() {
|
||||||
|
return allowMissingColumnNames;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the character marking the start of a line comment.
|
* Returns the character marking the start of a line comment.
|
||||||
*
|
*
|
||||||
|
@ -578,16 +576,6 @@ public final class CSVFormat implements Serializable {
|
||||||
return headerComments != null ? headerComments.clone() : null;
|
return headerComments != null ? headerComments.clone() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies whether missing column names are allowed when parsing the header line.
|
|
||||||
*
|
|
||||||
* @return {@code true} if missing column names are allowed when parsing the header line, {@code false} to throw an
|
|
||||||
* {@link IllegalArgumentException}.
|
|
||||||
*/
|
|
||||||
public boolean getAllowMissingColumnNames() {
|
|
||||||
return allowMissingColumnNames;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies whether empty lines between records are ignored when parsing input.
|
* Specifies whether empty lines between records are ignored when parsing input.
|
||||||
*
|
*
|
||||||
|
@ -598,15 +586,6 @@ public final class CSVFormat implements Serializable {
|
||||||
return ignoreEmptyLines;
|
return ignoreEmptyLines;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies whether spaces around values are ignored when parsing input.
|
|
||||||
*
|
|
||||||
* @return {@code true} if spaces around values are ignored, {@code false} if they are treated as part of the value.
|
|
||||||
*/
|
|
||||||
public boolean getIgnoreSurroundingSpaces() {
|
|
||||||
return ignoreSurroundingSpaces;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies whether header names will be accessed ignoring case.
|
* Specifies whether header names will be accessed ignoring case.
|
||||||
*
|
*
|
||||||
|
@ -616,6 +595,15 @@ public final class CSVFormat implements Serializable {
|
||||||
return ignoreHeaderCase;
|
return ignoreHeaderCase;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies whether spaces around values are ignored when parsing input.
|
||||||
|
*
|
||||||
|
* @return {@code true} if spaces around values are ignored, {@code false} if they are treated as part of the value.
|
||||||
|
*/
|
||||||
|
public boolean getIgnoreSurroundingSpaces() {
|
||||||
|
return ignoreSurroundingSpaces;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the String to convert to and from {@code null}.
|
* Gets the String to convert to and from {@code null}.
|
||||||
* <ul>
|
* <ul>
|
||||||
|
@ -805,6 +793,18 @@ public final class CSVFormat implements Serializable {
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String[] toStringArray(final Object[] values) {
|
||||||
|
if (values == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
final String[] strings = new String[values.length];
|
||||||
|
for (int i = 0; i < values.length; i++) {
|
||||||
|
final Object value = values[i];
|
||||||
|
strings[i] = value == null ? null : value.toString();
|
||||||
|
}
|
||||||
|
return strings;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verifies the consistency of the parameters and throws an IllegalArgumentException if necessary.
|
* Verifies the consistency of the parameters and throws an IllegalArgumentException if necessary.
|
||||||
*
|
*
|
||||||
|
@ -856,6 +856,31 @@ public final class CSVFormat implements Serializable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new {@code CSVFormat} with the missing column names behavior of the format set to {@code true}
|
||||||
|
*
|
||||||
|
* @return A new CSVFormat that is equal to this but with the specified missing column names behavior.
|
||||||
|
* @see #withAllowMissingColumnNames(boolean)
|
||||||
|
* @since 1.1
|
||||||
|
*/
|
||||||
|
public CSVFormat withAllowMissingColumnNames() {
|
||||||
|
return this.withAllowMissingColumnNames(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new {@code CSVFormat} with the missing column names behavior of the format set to the given value.
|
||||||
|
*
|
||||||
|
* @param allowMissingColumnNames
|
||||||
|
* the missing column names behavior, {@code true} to allow missing column names in the header line,
|
||||||
|
* {@code false} to cause an {@link IllegalArgumentException} to be thrown.
|
||||||
|
* @return A new CSVFormat that is equal to this but with the specified missing column names behavior.
|
||||||
|
*/
|
||||||
|
public CSVFormat withAllowMissingColumnNames(final boolean allowMissingColumnNames) {
|
||||||
|
return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,
|
||||||
|
ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
|
||||||
|
skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a new {@code CSVFormat} with the comment start marker of the format set to the specified character.
|
* Returns a new {@code CSVFormat} with the comment start marker of the format set to the specified character.
|
||||||
*
|
*
|
||||||
|
@ -940,35 +965,6 @@ public final class CSVFormat implements Serializable {
|
||||||
allowMissingColumnNames, ignoreHeaderCase);
|
allowMissingColumnNames, ignoreHeaderCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a new {@code CSVFormat} with the header of the format set to the given values.
|
|
||||||
* The header can either be parsed automatically from the input file with:
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
* CSVFormat format = aformat.withHeader();
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* or specified manually with:
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
* CSVFormat format = aformat.withHeader("name", "email", "phone");
|
|
||||||
* </pre>
|
|
||||||
* <p>
|
|
||||||
* The header is also used by the {@link CSVPrinter}..
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param header
|
|
||||||
* the header, {@code null} if disabled, empty if parsed automatically, user specified otherwise.
|
|
||||||
*
|
|
||||||
* @return A new CSVFormat that is equal to this but with the specified header
|
|
||||||
* @see #withSkipHeaderRecord(boolean)
|
|
||||||
*/
|
|
||||||
public CSVFormat withHeader(final String... header) {
|
|
||||||
return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,
|
|
||||||
ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
|
|
||||||
skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a new {@code CSVFormat} with the header of the format set from the result set metadata.
|
* Returns a new {@code CSVFormat} with the header of the format set from the result set metadata.
|
||||||
* The header can either be parsed automatically from the input file with:
|
* The header can either be parsed automatically from the input file with:
|
||||||
|
@ -1039,6 +1035,35 @@ public final class CSVFormat implements Serializable {
|
||||||
skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase);
|
skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new {@code CSVFormat} with the header of the format set to the given values.
|
||||||
|
* The header can either be parsed automatically from the input file with:
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* CSVFormat format = aformat.withHeader();
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* or specified manually with:
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* CSVFormat format = aformat.withHeader("name", "email", "phone");
|
||||||
|
* </pre>
|
||||||
|
* <p>
|
||||||
|
* The header is also used by the {@link CSVPrinter}..
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param header
|
||||||
|
* the header, {@code null} if disabled, empty if parsed automatically, user specified otherwise.
|
||||||
|
*
|
||||||
|
* @return A new CSVFormat that is equal to this but with the specified header
|
||||||
|
* @see #withSkipHeaderRecord(boolean)
|
||||||
|
*/
|
||||||
|
public CSVFormat withHeader(final String... header) {
|
||||||
|
return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,
|
||||||
|
ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
|
||||||
|
skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a new {@code CSVFormat} with the header comments of the format set to the given values.
|
* Returns a new {@code CSVFormat} with the header comments of the format set to the given values.
|
||||||
* The comments will be printed first, before the headers. This setting is ignored by the parser.
|
* The comments will be printed first, before the headers. This setting is ignored by the parser.
|
||||||
|
@ -1060,31 +1085,6 @@ public final class CSVFormat implements Serializable {
|
||||||
skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase);
|
skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a new {@code CSVFormat} with the missing column names behavior of the format set to {@code true}
|
|
||||||
*
|
|
||||||
* @return A new CSVFormat that is equal to this but with the specified missing column names behavior.
|
|
||||||
* @see #withAllowMissingColumnNames(boolean)
|
|
||||||
* @since 1.1
|
|
||||||
*/
|
|
||||||
public CSVFormat withAllowMissingColumnNames() {
|
|
||||||
return this.withAllowMissingColumnNames(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a new {@code CSVFormat} with the missing column names behavior of the format set to the given value.
|
|
||||||
*
|
|
||||||
* @param allowMissingColumnNames
|
|
||||||
* the missing column names behavior, {@code true} to allow missing column names in the header line,
|
|
||||||
* {@code false} to cause an {@link IllegalArgumentException} to be thrown.
|
|
||||||
* @return A new CSVFormat that is equal to this but with the specified missing column names behavior.
|
|
||||||
*/
|
|
||||||
public CSVFormat withAllowMissingColumnNames(final boolean allowMissingColumnNames) {
|
|
||||||
return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,
|
|
||||||
ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
|
|
||||||
skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a new {@code CSVFormat} with the empty line skipping behavior of the format set to {@code true}.
|
* Returns a new {@code CSVFormat} with the empty line skipping behavior of the format set to {@code true}.
|
||||||
*
|
*
|
||||||
|
@ -1110,31 +1110,6 @@ public final class CSVFormat implements Serializable {
|
||||||
skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase);
|
skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a new {@code CSVFormat} with the trimming behavior of the format set to {@code true}.
|
|
||||||
*
|
|
||||||
* @return A new CSVFormat that is equal to this but with the specified trimming behavior.
|
|
||||||
* @see #withIgnoreSurroundingSpaces(boolean)
|
|
||||||
* @since 1.1
|
|
||||||
*/
|
|
||||||
public CSVFormat withIgnoreSurroundingSpaces() {
|
|
||||||
return this.withIgnoreSurroundingSpaces(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a new {@code CSVFormat} with the trimming behavior of the format set to the given value.
|
|
||||||
*
|
|
||||||
* @param ignoreSurroundingSpaces
|
|
||||||
* the trimming behavior, {@code true} to remove the surrounding spaces, {@code false} to leave the
|
|
||||||
* spaces as is.
|
|
||||||
* @return A new CSVFormat that is equal to this but with the specified trimming behavior.
|
|
||||||
*/
|
|
||||||
public CSVFormat withIgnoreSurroundingSpaces(final boolean ignoreSurroundingSpaces) {
|
|
||||||
return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,
|
|
||||||
ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
|
|
||||||
skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a new {@code CSVFormat} with the header ignore case behavior set to {@code true}.
|
* Returns a new {@code CSVFormat} with the header ignore case behavior set to {@code true}.
|
||||||
*
|
*
|
||||||
|
@ -1160,6 +1135,31 @@ public final class CSVFormat implements Serializable {
|
||||||
skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase);
|
skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new {@code CSVFormat} with the trimming behavior of the format set to {@code true}.
|
||||||
|
*
|
||||||
|
* @return A new CSVFormat that is equal to this but with the specified trimming behavior.
|
||||||
|
* @see #withIgnoreSurroundingSpaces(boolean)
|
||||||
|
* @since 1.1
|
||||||
|
*/
|
||||||
|
public CSVFormat withIgnoreSurroundingSpaces() {
|
||||||
|
return this.withIgnoreSurroundingSpaces(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new {@code CSVFormat} with the trimming behavior of the format set to the given value.
|
||||||
|
*
|
||||||
|
* @param ignoreSurroundingSpaces
|
||||||
|
* the trimming behavior, {@code true} to remove the surrounding spaces, {@code false} to leave the
|
||||||
|
* spaces as is.
|
||||||
|
* @return A new CSVFormat that is equal to this but with the specified trimming behavior.
|
||||||
|
*/
|
||||||
|
public CSVFormat withIgnoreSurroundingSpaces(final boolean ignoreSurroundingSpaces) {
|
||||||
|
return new CSVFormat(delimiter, quoteCharacter, quoteMode, commentMarker, escapeCharacter,
|
||||||
|
ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator, nullString, headerComments, header,
|
||||||
|
skipHeaderRecord, allowMissingColumnNames, ignoreHeaderCase);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a new {@code CSVFormat} with conversions to and from null for strings on input and output.
|
* Returns a new {@code CSVFormat} with conversions to and from null for strings on input and output.
|
||||||
* <ul>
|
* <ul>
|
||||||
|
|
Loading…
Reference in New Issue