in src/main/java/com/univocity/parsers/csv/CsvWriter.java [186:235]
protected void processRow(Object[] row) {
if (recordCount == 0L && quotedFieldSelector != null) {
int[] quotedIndexes = quotedFieldSelector.getFieldIndexes(headers);
if (quotedIndexes.length > 0) {
quotedColumns = new HashSet<Integer>();
for (int idx : quotedIndexes) {
quotedColumns.add(idx);
}
}
}
for (int i = 0; i < row.length; i++) {
if (i != 0) {
appendToRow(separator);
}
if (dontProcessNormalizedNewLines) {
appender.enableDenormalizedLineEndings(false);
}
String nextElement = getStringValue(row[i]);
int originalLength = appender.length();
boolean isElementQuoted = append(quoteAllFields || quotedColumns.contains(i), nextElement);
//skipped all whitespaces and wrote nothing
if (appender.length() == originalLength && !usingNullOrEmptyValue) {
if (isElementQuoted) {
if (nextElement == null) {
append(false, nullValue);
} else {
append(true, emptyValue);
}
} else if (nextElement == null) {
append(false, nullValue);
} else {
append(false, emptyValue);
}
}
if (isElementQuoted) {
appendToRow(quoteChar);
appendValueToRow();
appendToRow(quoteChar);
if (dontProcessNormalizedNewLines) {
appender.enableDenormalizedLineEndings(true);
}
} else {
appendValueToRow();
}
}
}