forked from uniVocity/csv-parsers-comparison
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DataPipelineCsvParser.java
50 lines (38 loc) · 1.13 KB
/
DataPipelineCsvParser.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/**
* Note: this test depends on the DataPipeline.jar that must be obtained at: http://northconcepts.com/data-pipeline/
*
* Once obtain this library, add it to your classpath locally.
*/
/*
package com.univocity.articles.csvcomparison.parser;
import java.io.*;
import java.util.*;
import com.northconcepts.datapipeline.core.*;
import com.northconcepts.datapipeline.csv.*;
public class DataPipelineCsvParser extends AbstractParser {
protected DataPipelineCsvParser() {
super("Data pipeline");
}
@Override
public void processRows(File input) throws Exception {
DataReader reader = new CSVReader(input).setFieldNamesInFirstRow(true);
reader.open();
while (process(reader.read()));
reader.close();
}
@Override
public List<String[]> parseRows(File input) throws Exception {
List<String[]> rows = new ArrayList<String[]>();
DataReader reader = new CSVReader(input)
.setAllowMultiLineText(true)
.setFieldNamesInFirstRow(false);
reader.open();
Record record;
while ((record = reader.read()) != null) {
rows.add(record.getValues().toArray(new String[record.getFieldCount()]));
}
reader.close();
return rows;
}
}
*/