public static class CsvPreference.Builder extends Object
Constructor and Description |
---|
CsvPreference.Builder(char quoteChar,
int delimiterChar,
String endOfLineSymbols)
Constructs a Builder with the mandatory preference values.
|
CsvPreference.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 |
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 CsvPreference.Builder(CsvPreference preference)
preference
- the existing preferencepublic CsvPreference.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 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 build()
Copyright © 2007-2013 Super CSV. All Rights Reserved.