commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ebo...@apache.org
Subject svn commit: r1199997 - in /commons/sandbox/csv/trunk/src: main/java/org/apache/commons/csv/ test/java/org/apache/commons/csv/
Date Wed, 09 Nov 2011 22:04:02 GMT
Author: ebourg
Date: Wed Nov  9 22:04:01 2011
New Revision: 1199997

URL: http://svn.apache.org/viewvc?rev=1199997&view=rev
Log:
Renamed CSVParser.getAllValues() to getRecords()

Modified:
    commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java
    commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVUtils.java
    commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java
    commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java

Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java
URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java?rev=1199997&r1=1199996&r2=1199997&view=diff
==============================================================================
--- commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java (original)
+++ commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java Wed Nov
 9 22:04:01 2011
@@ -33,13 +33,13 @@ import static org.apache.commons.csv.CSV
  * <p>Parsing of a csv-string having tabs as separators,
  * '"' as an optional value encapsulator, and comments starting with '#':</p>
  * <pre>
- *  String[][] data =
+ *  String[][] record =
  *   (new CSVParser(new StringReader("a\tb\nc\td"), new CSVFormat('\t','"','#'))).getAllValues();
  * </pre>
  *
  * <p>Parsing of a csv-string in Excel CSV format</p>
  * <pre>
- *  String[][] data =
+ *  String[][] record =
  *   (new CSVParser(new StringReader("a;b\nc;d"), CSVFormat.EXCEL)).getAllValues();
  * </pre>
  *
@@ -150,7 +150,7 @@ public class CSVParser {
      * @return matrix of records x values ('null' when end of file)
      * @throws IOException on parse error or input read-failure
      */
-    public String[][] getAllValues() throws IOException {
+    public String[][] getRecords() throws IOException {
         List<String[]> records = new ArrayList<String[]>();
         String[] values;
         String[][] ret = null;

Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVUtils.java
URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVUtils.java?rev=1199997&r1=1199996&r2=1199997&view=diff
==============================================================================
--- commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVUtils.java (original)
+++ commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CSVUtils.java Wed Nov 
9 22:04:01 2011
@@ -88,7 +88,7 @@ public class CSVUtils {
         if (s == null) {
             throw new IllegalArgumentException("Null argument not allowed.");
         }
-        String[][] result = (new CSVParser(new StringReader(s))).getAllValues();
+        String[][] result = (new CSVParser(new StringReader(s))).getRecords();
         if (result == null) {
             // since CSVFormat ignores empty lines an empty array is returned
             // (i.e. not "result = new String[][] {{""}};")

Modified: commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java?rev=1199997&r1=1199996&r2=1199997&view=diff
==============================================================================
--- commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java (original)
+++ commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java Wed
Nov  9 22:04:01 2011
@@ -221,7 +221,7 @@ public class CSVParserTest extends TestC
 
     public void testGetAllValues() throws IOException {
         CSVParser parser = new CSVParser(new StringReader(code));
-        String[][] tmp = parser.getAllValues();
+        String[][] tmp = parser.getRecords();
         assertEquals(res.length, tmp.length);
         assertTrue(tmp.length > 0);
         for (int i = 0; i < res.length; i++) {
@@ -241,7 +241,7 @@ public class CSVParserTest extends TestC
                 {"\"hello\"", "  \"world\"", "abc\ndef", ""}
         };
         CSVParser parser = new CSVParser(new StringReader(code), CSVFormat.EXCEL);
-        String[][] tmp = parser.getAllValues();
+        String[][] tmp = parser.getRecords();
         assertEquals(res.length, tmp.length);
         assertTrue(tmp.length > 0);
         for (int i = 0; i < res.length; i++) {
@@ -259,7 +259,7 @@ public class CSVParserTest extends TestC
                 {"world", ""}
         };
         CSVParser parser = new CSVParser(new StringReader(code), CSVFormat.EXCEL);
-        String[][] tmp = parser.getAllValues();
+        String[][] tmp = parser.getRecords();
         assertEquals(res.length, tmp.length);
         assertTrue(tmp.length > 0);
         for (int i = 0; i < res.length; i++) {
@@ -286,7 +286,7 @@ public class CSVParserTest extends TestC
         
         for (String code : codes) {
             CSVParser parser = new CSVParser(new StringReader(code), CSVFormat.EXCEL);
-            String[][] tmp = parser.getAllValues();
+            String[][] tmp = parser.getRecords();
             assertEquals(res.length, tmp.length);
             assertTrue(tmp.length > 0);
             for (int i = 0; i < res.length; i++) {
@@ -314,7 +314,7 @@ public class CSVParserTest extends TestC
         for (int codeIndex = 0; codeIndex < codes.length; codeIndex++) {
             code = codes[codeIndex];
             CSVParser parser = new CSVParser(new StringReader(code));
-            String[][] tmp = parser.getAllValues();
+            String[][] tmp = parser.getRecords();
             assertEquals(res.length, tmp.length);
             assertTrue(tmp.length > 0);
             for (int i = 0; i < res.length; i++) {
@@ -339,7 +339,7 @@ public class CSVParserTest extends TestC
         for (int codeIndex = 0; codeIndex < codes.length; codeIndex++) {
             code = codes[codeIndex];
             CSVParser parser = new CSVParser(new StringReader(code), CSVFormat.EXCEL);
-            String[][] tmp = parser.getAllValues();
+            String[][] tmp = parser.getRecords();
             assertEquals(res.length, tmp.length);
             assertTrue(tmp.length > 0);
             for (int i = 0; i < res.length; i++) {
@@ -362,7 +362,7 @@ public class CSVParserTest extends TestC
         for (int codeIndex = 0; codeIndex < codes.length; codeIndex++) {
             code = codes[codeIndex];
             CSVParser parser = new CSVParser(new StringReader(code));
-            String[][] tmp = parser.getAllValues();
+            String[][] tmp = parser.getRecords();
             assertEquals(res.length, tmp.length);
             assertTrue(tmp.length > 0);
             for (int i = 0; i < res.length; i++) {
@@ -394,7 +394,7 @@ public class CSVParserTest extends TestC
                 {"a\\\\,b"}    // backslash in quotes only escapes a delimiter (",")
         };
         CSVParser parser = new CSVParser(new StringReader(code));
-        String[][] tmp = parser.getAllValues();
+        String[][] tmp = parser.getRecords();
         assertEquals(res.length, tmp.length);
         assertTrue(tmp.length > 0);
         for (int i = 0; i < res.length; i++) {
@@ -437,7 +437,7 @@ public class CSVParserTest extends TestC
         CSVFormat format = new CSVFormat(',', '\'', CSVFormat.COMMENTS_DISABLED, '/', false,
false, true, true);
 
         CSVParser parser = new CSVParser(new StringReader(code), format);
-        String[][] tmp = parser.getAllValues();
+        String[][] tmp = parser.getRecords();
         assertTrue(tmp.length > 0);
         for (int i = 0; i < res.length; i++) {
             assertTrue(Arrays.equals(res[i], tmp[i]));
@@ -465,7 +465,7 @@ public class CSVParserTest extends TestC
         CSVFormat format = new CSVFormat(',', CSVFormat.ENCAPSULATOR_DISABLED, CSVFormat.COMMENTS_DISABLED,
'/', false, false, true, true);
 
         CSVParser parser = new CSVParser(new StringReader(code), format);
-        String[][] tmp = parser.getAllValues();
+        String[][] tmp = parser.getRecords();
         assertTrue(tmp.length > 0);
 
         if (!CSVPrinterTest.equals(res, tmp)) {
@@ -492,7 +492,7 @@ public class CSVParserTest extends TestC
         assertEquals(CSVFormat.COMMENTS_DISABLED, format.getCommentStart());
 
         CSVParser parser = new CSVParser(new StringReader(code), format);
-        String[][] tmp = parser.getAllValues();
+        String[][] tmp = parser.getRecords();
         assertTrue(tmp.length > 0);
 
         if (!CSVPrinterTest.equals(res, tmp)) {
@@ -507,7 +507,7 @@ public class CSVParserTest extends TestC
 
         format = new CSVFormat(',', '"', '#');
         parser = new CSVParser(new StringReader(code), format);
-        tmp = parser.getAllValues();
+        tmp = parser.getRecords();
 
         if (!CSVPrinterTest.equals(res_comments, tmp)) {
             assertTrue(false);
@@ -527,21 +527,21 @@ public class CSVParserTest extends TestC
     public void testCarriageReturnLineFeedEndings() throws IOException {
         String code = "foo\r\nbaar,\r\nhello,world\r\n,kanu";
         CSVParser parser = new CSVParser(new StringReader(code));
-        String[][] data = parser.getAllValues();
+        String[][] data = parser.getRecords();
         assertEquals(4, data.length);
     }
 
     public void testCarriageReturnEndings() throws IOException {
         String code = "foo\rbaar,\rhello,world\r,kanu";
         CSVParser parser = new CSVParser(new StringReader(code));
-        String[][] data = parser.getAllValues();
+        String[][] data = parser.getRecords();
         assertEquals(4, data.length);
     }
 
     public void testLineFeedEndings() throws IOException {
         String code = "foo\nbaar,\nhello,world\n,kanu";
         CSVParser parser = new CSVParser(new StringReader(code));
-        String[][] data = parser.getAllValues();
+        String[][] data = parser.getRecords();
         assertEquals(4, data.length);
     }
 
@@ -550,7 +550,7 @@ public class CSVParserTest extends TestC
         //String code = "world\r\n\n";
         //String code = "foo;baar\r\n\r\nhello;\r\n\r\nworld;\r\n";
         CSVParser parser = new CSVParser(new StringReader(code));
-        String[][] data = parser.getAllValues();
+        String[][] data = parser.getRecords();
         assertEquals(3, data.length);
     }
 

Modified: commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java?rev=1199997&r1=1199996&r2=1199997&view=diff
==============================================================================
--- commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java (original)
+++ commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java Wed
Nov  9 22:04:01 2011
@@ -152,7 +152,7 @@ public class CSVPrinterTest extends Test
         StringReader reader = new StringReader(result);
 
         CSVParser parser = new CSVParser(reader, format);
-        String[][] parseResult = parser.getAllValues();
+        String[][] parseResult = parser.getRecords();
 
         if (!equals(lines, parseResult)) {
             System.out.println("Printer output :" + printable(result));



Mime
View raw message