mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-25 01:08:52 -05:00
Close stream
This commit is contained in:
parent
93937680a7
commit
b452414614
@ -214,16 +214,17 @@ public final class FileUtilities {
|
|||||||
return destination;
|
return destination;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String[]> readCSV(InputStream source, String charsetName, String separatorPattern) {
|
public static List<String[]> readCSV(InputStream source, String charsetName, String pattern) {
|
||||||
Scanner scanner = new Scanner(source, charsetName);
|
try (Scanner scanner = new Scanner(source, charsetName)) {
|
||||||
Pattern separator = Pattern.compile(separatorPattern);
|
Pattern separator = Pattern.compile(pattern);
|
||||||
List<String[]> rows = new ArrayList<String[]>(65536);
|
List<String[]> rows = new ArrayList<String[]>(65536);
|
||||||
|
|
||||||
while (scanner.hasNextLine()) {
|
while (scanner.hasNextLine()) {
|
||||||
rows.add(separator.split(scanner.nextLine()));
|
rows.add(separator.split(scanner.nextLine()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
return rows;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Reader createTextReader(File file) throws IOException {
|
public static Reader createTextReader(File file) throws IOException {
|
||||||
|
Loading…
Reference in New Issue
Block a user