Skip to content

Commit a7bd28c

Browse files
committed
Renamed CSVParser.getAllValues() to getRecords()
git-svn-id: https://svn.apache.org/repos/asf/commons/sandbox/csv/trunk@1199997 13f79535-47bb-0310-9956-ffa450edef68
1 parent 16bfec0 commit a7bd28c

4 files changed

Lines changed: 21 additions & 21 deletions

File tree

src/main/java/org/apache/commons/csv/CSVParser.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@
3333
* <p>Parsing of a csv-string having tabs as separators,
3434
* '"' as an optional value encapsulator, and comments starting with '#':</p>
3535
* <pre>
36-
* String[][] data =
36+
* String[][] record =
3737
* (new CSVParser(new StringReader("a\tb\nc\td"), new CSVFormat('\t','"','#'))).getAllValues();
3838
* </pre>
3939
*
4040
* <p>Parsing of a csv-string in Excel CSV format</p>
4141
* <pre>
42-
* String[][] data =
42+
* String[][] record =
4343
* (new CSVParser(new StringReader("a;b\nc;d"), CSVFormat.EXCEL)).getAllValues();
4444
* </pre>
4545
*
@@ -150,7 +150,7 @@ public CSVParser(Reader input, CSVFormat format) {
150150
* @return matrix of records x values ('null' when end of file)
151151
* @throws IOException on parse error or input read-failure
152152
*/
153-
public String[][] getAllValues() throws IOException {
153+
public String[][] getRecords() throws IOException {
154154
List<String[]> records = new ArrayList<String[]>();
155155
String[] values;
156156
String[][] ret = null;

src/main/java/org/apache/commons/csv/CSVUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public static String[][] parse(String s) throws IOException {
8888
if (s == null) {
8989
throw new IllegalArgumentException("Null argument not allowed.");
9090
}
91-
String[][] result = (new CSVParser(new StringReader(s))).getAllValues();
91+
String[][] result = (new CSVParser(new StringReader(s))).getRecords();
9292
if (result == null) {
9393
// since CSVFormat ignores empty lines an empty array is returned
9494
// (i.e. not "result = new String[][] {{""}};")

src/test/java/org/apache/commons/csv/CSVParserTest.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ public void testGetLine() throws IOException {
221221

222222
public void testGetAllValues() throws IOException {
223223
CSVParser parser = new CSVParser(new StringReader(code));
224-
String[][] tmp = parser.getAllValues();
224+
String[][] tmp = parser.getRecords();
225225
assertEquals(res.length, tmp.length);
226226
assertTrue(tmp.length > 0);
227227
for (int i = 0; i < res.length; i++) {
@@ -241,7 +241,7 @@ public void testExcelFormat1() throws IOException {
241241
{"\"hello\"", " \"world\"", "abc\ndef", ""}
242242
};
243243
CSVParser parser = new CSVParser(new StringReader(code), CSVFormat.EXCEL);
244-
String[][] tmp = parser.getAllValues();
244+
String[][] tmp = parser.getRecords();
245245
assertEquals(res.length, tmp.length);
246246
assertTrue(tmp.length > 0);
247247
for (int i = 0; i < res.length; i++) {
@@ -259,7 +259,7 @@ public void testExcelFormat2() throws Exception {
259259
{"world", ""}
260260
};
261261
CSVParser parser = new CSVParser(new StringReader(code), CSVFormat.EXCEL);
262-
String[][] tmp = parser.getAllValues();
262+
String[][] tmp = parser.getRecords();
263263
assertEquals(res.length, tmp.length);
264264
assertTrue(tmp.length > 0);
265265
for (int i = 0; i < res.length; i++) {
@@ -286,7 +286,7 @@ public void testEndOfFileBehaviourExcel() throws Exception {
286286

287287
for (String code : codes) {
288288
CSVParser parser = new CSVParser(new StringReader(code), CSVFormat.EXCEL);
289-
String[][] tmp = parser.getAllValues();
289+
String[][] tmp = parser.getRecords();
290290
assertEquals(res.length, tmp.length);
291291
assertTrue(tmp.length > 0);
292292
for (int i = 0; i < res.length; i++) {
@@ -314,7 +314,7 @@ public void testEndOfFileBehaviorCSV() throws Exception {
314314
for (int codeIndex = 0; codeIndex < codes.length; codeIndex++) {
315315
code = codes[codeIndex];
316316
CSVParser parser = new CSVParser(new StringReader(code));
317-
String[][] tmp = parser.getAllValues();
317+
String[][] tmp = parser.getRecords();
318318
assertEquals(res.length, tmp.length);
319319
assertTrue(tmp.length > 0);
320320
for (int i = 0; i < res.length; i++) {
@@ -339,7 +339,7 @@ public void testEmptyLineBehaviourExcel() throws Exception {
339339
for (int codeIndex = 0; codeIndex < codes.length; codeIndex++) {
340340
code = codes[codeIndex];
341341
CSVParser parser = new CSVParser(new StringReader(code), CSVFormat.EXCEL);
342-
String[][] tmp = parser.getAllValues();
342+
String[][] tmp = parser.getRecords();
343343
assertEquals(res.length, tmp.length);
344344
assertTrue(tmp.length > 0);
345345
for (int i = 0; i < res.length; i++) {
@@ -362,7 +362,7 @@ public void testEmptyLineBehaviourCSV() throws Exception {
362362
for (int codeIndex = 0; codeIndex < codes.length; codeIndex++) {
363363
code = codes[codeIndex];
364364
CSVParser parser = new CSVParser(new StringReader(code));
365-
String[][] tmp = parser.getAllValues();
365+
String[][] tmp = parser.getRecords();
366366
assertEquals(res.length, tmp.length);
367367
assertTrue(tmp.length > 0);
368368
for (int i = 0; i < res.length; i++) {
@@ -394,7 +394,7 @@ public void OLDtestBackslashEscaping() throws IOException {
394394
{"a\\\\,b"} // backslash in quotes only escapes a delimiter (",")
395395
};
396396
CSVParser parser = new CSVParser(new StringReader(code));
397-
String[][] tmp = parser.getAllValues();
397+
String[][] tmp = parser.getRecords();
398398
assertEquals(res.length, tmp.length);
399399
assertTrue(tmp.length > 0);
400400
for (int i = 0; i < res.length; i++) {
@@ -437,7 +437,7 @@ public void testBackslashEscaping() throws IOException {
437437
CSVFormat format = new CSVFormat(',', '\'', CSVFormat.COMMENTS_DISABLED, '/', false, false, true, true);
438438

439439
CSVParser parser = new CSVParser(new StringReader(code), format);
440-
String[][] tmp = parser.getAllValues();
440+
String[][] tmp = parser.getRecords();
441441
assertTrue(tmp.length > 0);
442442
for (int i = 0; i < res.length; i++) {
443443
assertTrue(Arrays.equals(res[i], tmp[i]));
@@ -465,7 +465,7 @@ public void testBackslashEscaping2() throws IOException {
465465
CSVFormat format = new CSVFormat(',', CSVFormat.ENCAPSULATOR_DISABLED, CSVFormat.COMMENTS_DISABLED, '/', false, false, true, true);
466466

467467
CSVParser parser = new CSVParser(new StringReader(code), format);
468-
String[][] tmp = parser.getAllValues();
468+
String[][] tmp = parser.getRecords();
469469
assertTrue(tmp.length > 0);
470470

471471
if (!CSVPrinterTest.equals(res, tmp)) {
@@ -492,7 +492,7 @@ public void testDefaultFormat() throws IOException {
492492
assertEquals(CSVFormat.COMMENTS_DISABLED, format.getCommentStart());
493493

494494
CSVParser parser = new CSVParser(new StringReader(code), format);
495-
String[][] tmp = parser.getAllValues();
495+
String[][] tmp = parser.getRecords();
496496
assertTrue(tmp.length > 0);
497497

498498
if (!CSVPrinterTest.equals(res, tmp)) {
@@ -507,7 +507,7 @@ public void testDefaultFormat() throws IOException {
507507

508508
format = new CSVFormat(',', '"', '#');
509509
parser = new CSVParser(new StringReader(code), format);
510-
tmp = parser.getAllValues();
510+
tmp = parser.getRecords();
511511

512512
if (!CSVPrinterTest.equals(res_comments, tmp)) {
513513
assertTrue(false);
@@ -527,21 +527,21 @@ public void testUnicodeEscape() throws IOException {
527527
public void testCarriageReturnLineFeedEndings() throws IOException {
528528
String code = "foo\r\nbaar,\r\nhello,world\r\n,kanu";
529529
CSVParser parser = new CSVParser(new StringReader(code));
530-
String[][] data = parser.getAllValues();
530+
String[][] data = parser.getRecords();
531531
assertEquals(4, data.length);
532532
}
533533

534534
public void testCarriageReturnEndings() throws IOException {
535535
String code = "foo\rbaar,\rhello,world\r,kanu";
536536
CSVParser parser = new CSVParser(new StringReader(code));
537-
String[][] data = parser.getAllValues();
537+
String[][] data = parser.getRecords();
538538
assertEquals(4, data.length);
539539
}
540540

541541
public void testLineFeedEndings() throws IOException {
542542
String code = "foo\nbaar,\nhello,world\n,kanu";
543543
CSVParser parser = new CSVParser(new StringReader(code));
544-
String[][] data = parser.getAllValues();
544+
String[][] data = parser.getRecords();
545545
assertEquals(4, data.length);
546546
}
547547

@@ -550,7 +550,7 @@ public void testIgnoreEmptyLines() throws IOException {
550550
//String code = "world\r\n\n";
551551
//String code = "foo;baar\r\n\r\nhello;\r\n\r\nworld;\r\n";
552552
CSVParser parser = new CSVParser(new StringReader(code));
553-
String[][] data = parser.getAllValues();
553+
String[][] data = parser.getRecords();
554554
assertEquals(3, data.length);
555555
}
556556

src/test/java/org/apache/commons/csv/CSVPrinterTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public void doOneRandom() throws Exception {
152152
StringReader reader = new StringReader(result);
153153

154154
CSVParser parser = new CSVParser(reader, format);
155-
String[][] parseResult = parser.getAllValues();
155+
String[][] parseResult = parser.getRecords();
156156

157157
if (!equals(lines, parseResult)) {
158158
System.out.println("Printer output :" + printable(result));

0 commit comments

Comments
 (0)