commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From joe...@apache.org
Subject svn commit: r1003046 - in /commons/sandbox/csv/trunk/src/java/org/apache/commons/csv/writer: CSVConfig.java CSVWriter.java
Date Thu, 30 Sep 2010 12:48:59 GMT
Author: joehni
Date: Thu Sep 30 12:48:59 2010
New Revision: 1003046

URL: http://svn.apache.org/viewvc?rev=1003046&view=rev
Log:
Apply configurable row delimiter by Dmitry Drozdov (SANDBOX-329).

Modified:
    commons/sandbox/csv/trunk/src/java/org/apache/commons/csv/writer/CSVConfig.java
    commons/sandbox/csv/trunk/src/java/org/apache/commons/csv/writer/CSVWriter.java

Modified: commons/sandbox/csv/trunk/src/java/org/apache/commons/csv/writer/CSVConfig.java
URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/java/org/apache/commons/csv/writer/CSVConfig.java?rev=1003046&r1=1003045&r2=1003046&view=diff
==============================================================================
--- commons/sandbox/csv/trunk/src/java/org/apache/commons/csv/writer/CSVConfig.java (original)
+++ commons/sandbox/csv/trunk/src/java/org/apache/commons/csv/writer/CSVConfig.java Thu Sep
30 12:48:59 2010
@@ -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 " */
@@ -185,6 +187,21 @@ public class CSVConfig {
     }
 
     /**
+     * @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.
      */
     public boolean isDelimiterIgnored() {

Modified: commons/sandbox/csv/trunk/src/java/org/apache/commons/csv/writer/CSVWriter.java
URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/java/org/apache/commons/csv/writer/CSVWriter.java?rev=1003046&r1=1003045&r2=1003046&view=diff
==============================================================================
--- commons/sandbox/csv/trunk/src/java/org/apache/commons/csv/writer/CSVWriter.java (original)
+++ commons/sandbox/csv/trunk/src/java/org/apache/commons/csv/writer/CSVWriter.java Thu Sep
30 12:48:59 2010
@@ -70,7 +70,7 @@ public class CSVWriter {
                     }
                 }
             }
-            sb.append("\n");
+            sb.append(config.getRowDelimiter());
             String line = sb.toString();
             writer.write(line);
         } catch(Exception e) {



Mime
View raw message