Finished CSV scanner
Signed-off-by: Jim Martens <github@2martens.de>
This commit is contained in:
parent
58e8e39ee7
commit
0ae6d6ed20
|
@ -1,6 +1,7 @@
|
||||||
package de.dis2017.data.db;
|
package de.dis2017.data.db;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -16,7 +17,8 @@ public class CSVScanner {
|
||||||
public static List<List<String>> scan(String file) throws FileNotFoundException {
|
public static List<List<String>> scan(String file) throws FileNotFoundException {
|
||||||
List<List<String>> entries = new ArrayList<>();
|
List<List<String>> entries = new ArrayList<>();
|
||||||
|
|
||||||
Scanner scanner = new Scanner(new File(file));
|
Scanner scanner = new Scanner(new FileInputStream(new File(file)));
|
||||||
|
scanner.useDelimiter("\n");
|
||||||
while (scanner.hasNextLine()) {
|
while (scanner.hasNextLine()) {
|
||||||
List<String> line = new ArrayList<>();
|
List<String> line = new ArrayList<>();
|
||||||
String line_str = scanner.nextLine();
|
String line_str = scanner.nextLine();
|
||||||
|
|
Loading…
Reference in New Issue