File tree 3 files changed +36
-1
lines changed
common/core/src/test/java/zingg/common/core/util
3 files changed +36
-1
lines changed Original file line number Diff line number Diff line change
1
+ package zingg .common .core .util ;
2
+
3
+ import java .io .File ;
4
+ import java .io .FileNotFoundException ;
5
+ import java .util .ArrayList ;
6
+ import java .util .List ;
7
+ import java .util .Scanner ;
8
+
9
+ public class CsvReader {
10
+ protected List <? extends IFromCsv > records ;
11
+ IFromCsv creator ;
12
+
13
+ public CsvReader (IFromCsv creator ){
14
+ records = new ArrayList <IFromCsv >();
15
+ this .creator = creator ;
16
+ }
17
+
18
+ public List <? extends IFromCsv > getRecords (String file , boolean skipHeader ) throws FileNotFoundException {
19
+ int lineno = 0 ;
20
+ try (Scanner scanner = new Scanner (new File (file ))) {
21
+ while (scanner .hasNextLine ()) {
22
+ records .add (creator .fromCsv (scanner .nextLine ()));
23
+ }
24
+ }
25
+ return records ;
26
+ }
27
+
28
+ }
Original file line number Diff line number Diff line change
1
+ package zingg .common .core .util ;
2
+
3
+ public interface IFromCsv {
4
+
5
+ <C > C fromCsv (String s );
6
+
7
+ }
Original file line number Diff line number Diff line change 1
- package zingg .common .infra .util ;
1
+ package zingg .common .core .util ;
2
2
3
3
import java .lang .reflect .*;
4
4
import java .security .NoSuchAlgorithmException ;
You can’t perform that action at this time.
0 commit comments