public static class CsvPreference.Builder extends Object
Constructor and Description |
---|
Builder(char quoteChar,
int delimiterChar,
String endOfLineSymbols)
Constructs a Builder with the mandatory preference values.
|
Builder(CsvPreference preference)
Constructs a Builder with all of the values from an existing CsvPreference instance.
|
Modifier and Type | Method and Description |
---|---|
CsvPreference |
build()
Builds the CsvPreference instance.
|
CsvPreference.Builder |
ignoreEmptyLines(boolean ignoreEmptyLines)
Flag indicating whether empty lines (i.e.
|
CsvPreference.Builder |
maxLinesPerRow(int maxLinesPerRow)
The maximum number of lines that a row can span before an exception is thrown (only applicable when reading
CSV).
|
CsvPreference.Builder |
skipComments(CommentMatcher commentMatcher)
Enables the skipping of comments.
|
CsvPreference.Builder |
surroundingSpacesNeedQuotes(boolean surroundingSpacesNeedQuotes)
Flag indicating whether spaces at the beginning or end of a cell should be ignored if they're not surrounded
by quotes (applicable to both reading and writing CSV).
|
CsvPreference.Builder |
useEncoder(CsvEncoder encoder)
Uses a custom CsvEncoder to escape CSV for writing.
|
CsvPreference.Builder |
useQuoteMode(QuoteMode quoteMode)
Uses a custom QuoteMode to determine if surrounding quotes should be applied when writing (only applicable if
a column doesn't contain any special characters and wouldn't otherwise be quoted).
|
public Builder(CsvPreference preference)
preference
- the existing preferencepublic Builder(char quoteChar, int delimiterChar, String endOfLineSymbols)
quoteChar
- matching pairs of this character are used to escape columns containing the delimiterdelimiterChar
- the character separating each columnendOfLineSymbols
- one or more symbols terminating the line, e.g. "\n". Only used for writing.IllegalArgumentException
- if quoteChar and delimiterChar are the same characterNullPointerException
- if endOfLineSymbols is nullpublic CsvPreference.Builder surroundingSpacesNeedQuotes(boolean surroundingSpacesNeedQuotes)
surroundingSpacesNeedQuotes
- flag indicating whether spaces at the beginning or end of a cell should be ignored if they're not
surrounded by quotespublic CsvPreference.Builder ignoreEmptyLines(boolean ignoreEmptyLines)
ignoreEmptyLines
- flag indicating whether empty lines should be ignoredpublic CsvPreference.Builder skipComments(CommentMatcher commentMatcher)
CommentStartsWith
or
CommentMatches
commentMatcher
- the comment matcher to useNullPointerException
- if commentMatcher is nullpublic CsvPreference.Builder useEncoder(CsvEncoder encoder)
encoder
- the custom encoderNullPointerException
- if encoder is nullpublic CsvPreference.Builder useQuoteMode(QuoteMode quoteMode)
AlwaysQuoteMode
or
ColumnQuoteMode
quoteMode
- the quote modeNullPointerException
- if quoteMode is nullpublic CsvPreference.Builder maxLinesPerRow(int maxLinesPerRow)
maxLinesPerRow
- the maximum number of lines a row can span before an exception is thrownpublic CsvPreference build()
Copyright © 2007–2015 Super CSV. All rights reserved.