1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-08-13 17:03:45 -04:00

Close stream

This commit is contained in:
Reinhard Pointner 2016-03-05 21:06:20 +00:00
parent 93937680a7
commit b452414614

View File

@ -214,9 +214,9 @@ 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()) {
@ -225,6 +225,7 @@ public final class FileUtilities {
return rows; return rows;
} }
}
public static Reader createTextReader(File file) throws IOException { public static Reader createTextReader(File file) throws IOException {
CharsetDetector detector = new CharsetDetector(); CharsetDetector detector = new CharsetDetector();