use of com.univocity.parsers.csv.CsvWriterSettings in project symja_android_library by axkr.
the class CsvWriter method createSettings.
protected static CsvWriterSettings createSettings(CsvWriteOptions options) {
CsvWriterSettings settings = new CsvWriterSettings();
// Sets the character sequence to write for the values that are null.
settings.setNullValue(nullValue);
if (options.separator() != null) {
settings.getFormat().setDelimiter(options.separator());
}
if (options.quoteChar() != null) {
settings.getFormat().setQuote(options.quoteChar());
}
if (options.escapeChar() != null) {
settings.getFormat().setQuoteEscape(options.escapeChar());
}
if (options.lineEnd() != null) {
settings.getFormat().setLineSeparator(options.lineEnd());
}
settings.setIgnoreLeadingWhitespaces(options.ignoreLeadingWhitespaces());
settings.setIgnoreTrailingWhitespaces(options.ignoreTrailingWhitespaces());
// writes empty lines as well.
settings.setSkipEmptyLines(false);
settings.setQuoteAllFields(options.quoteAllFields());
return settings;
}
Aggregations