* Creates or obtains {@code org.supercsv.prefs.CsvPreference} according to the configuration in JSL document.
*
* @return CsvPreference
*/
protected CsvPreference getCsvPreference() {
CsvPreference csvPreference;
if (preference == null || STANDARD_PREFERENCE.equals(preference)) {
csvPreference = CsvPreference.STANDARD_PREFERENCE;
} else if (EXCEL_PREFERENCE.equals(preference)) {
csvPreference = CsvPreference.EXCEL_PREFERENCE;
} else if (EXCEL_NORTH_EUROPE_PREFERENCE.equals(preference)) {
csvPreference = CsvPreference.EXCEL_NORTH_EUROPE_PREFERENCE;
} else if (TAB_PREFERENCE.equals(preference)) {
csvPreference = CsvPreference.TAB_PREFERENCE;
} else {
throw SupportMessages.MESSAGES.invalidReaderWriterProperty(null, preference, PREFERENCE_KEY);
}
//do not trim quoteChar or delimiterChar. They can be tab (\t) and after trim, it will be just empty
if (quoteChar != null || delimiterChar != null || endOfLineSymbols != null ||
surroundingSpacesNeedQuotes != null || commentMatcher != null || encoder != null || quoteMode != null) {
final CsvPreference.Builder builder = new CsvPreference.Builder(
quoteChar == null ? (char) csvPreference.getQuoteChar() : quoteChar.charAt(0),
delimiterChar == null ? csvPreference.getDelimiterChar() : (int) delimiterChar.charAt(0),
endOfLineSymbols == null ? csvPreference.getEndOfLineSymbols() : endOfLineSymbols.trim()
);
if (surroundingSpacesNeedQuotes != null) {
builder.surroundingSpacesNeedQuotes(Boolean.parseBoolean(surroundingSpacesNeedQuotes.trim()));
}
if (commentMatcher != null) {