File tree Expand file tree Collapse file tree
src/java/org/apache/commons/csv/writer Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -50,6 +50,8 @@ public class CSVConfig {
5050 private char fillChar = ' ' ;
5151 /** The seperator character. Defaults to , */
5252 private char delimiter = ',' ;
53+ /** The row separator. Defaults to \n */
54+ private String rowDelimiter = "\n " ;
5355 /** Should we ignore the delimiter. Defaults to false */
5456 private boolean ignoreDelimiter = false ;
5557 /** the value delimiter. Defaults to " */
@@ -184,6 +186,21 @@ public void setDelimiter(char delimiter) {
184186 this .delimiter = delimiter ;
185187 }
186188
189+ /**
190+ * @return the rowDelimiter used.
191+ */
192+ public String getRowDelimiter () {
193+ return rowDelimiter ;
194+ }
195+
196+ /**
197+ * Set the rowDelimiter to use
198+ * @param rowDelimiter the row delimiter character.
199+ */
200+ public void setRowDelimiter (String rowDelimiter ) {
201+ this .rowDelimiter = rowDelimiter ;
202+ }
203+
187204 /**
188205 * @return if the writer should ignore the delimiter character.
189206 */
Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ public void writeRecord(Map map) {
7070 }
7171 }
7272 }
73- sb .append (" \n " );
73+ sb .append (config . getRowDelimiter () );
7474 String line = sb .toString ();
7575 writer .write (line );
7676 } catch (Exception e ) {
You can’t perform that action at this time.
0 commit comments