Apply configurable row delimiter by Dmitry Drozdov (SANDBOX-329).

git-svn-id: https://svn.apache.org/repos/asf/commons/sandbox/csv/trunk@1003046 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Joerg Schaible 2010-09-30 12:48:59 +00:00
parent 0d63758e09
commit 6eddaf8b0c
2 changed files with 18 additions and 1 deletions

View File

@ -50,6 +50,8 @@ public class CSVConfig {
private char fillChar = ' ';
/** The seperator character. Defaults to , */
private char delimiter = ',';
/** The row separator. Defaults to \n */
private String rowDelimiter = "\n";
/** Should we ignore the delimiter. Defaults to false */
private boolean ignoreDelimiter = false;
/** the value delimiter. Defaults to " */
@ -184,6 +186,21 @@ public class CSVConfig {
this.delimiter = delimiter;
}
/**
* @return the rowDelimiter used.
*/
public String getRowDelimiter() {
return rowDelimiter;
}
/**
* Set the rowDelimiter to use
* @param rowDelimiter the row delimiter character.
*/
public void setRowDelimiter(String rowDelimiter) {
this.rowDelimiter = rowDelimiter;
}
/**
* @return if the writer should ignore the delimiter character.
*/

View File

@ -70,7 +70,7 @@ public class CSVWriter {
}
}
}
sb.append("\n");
sb.append(config.getRowDelimiter());
String line = sb.toString();
writer.write(line);
} catch(Exception e) {