Search in sources :

Example 1 with Location

use of org.apache.metron.dataloads.nonbulk.flatfile.location.Location in project metron by apache.

the class AbstractLocalImporter method extractWholeFiles.

public void extractWholeFiles(List<String> inputs, FileSystem fs, ThreadLocal<STATE_T> state, boolean quiet) throws IOException {
    final Progress progress = new Progress();
    final List<Location> locations = getLocationsRecursive(inputs, fs);
    locations.parallelStream().forEach(loc -> {
        try (BufferedReader br = loc.openReader()) {
            String s = br.lines().collect(Collectors.joining());
            extract(state.get(), s);
            if (!quiet) {
                progress.update();
            }
        } catch (IOException e) {
            throw new IllegalStateException("Unable to read " + loc + ": " + e.getMessage(), e);
        }
    });
}
Also used : BufferedReader(java.io.BufferedReader) IOException(java.io.IOException) Location(org.apache.metron.dataloads.nonbulk.flatfile.location.Location)

Aggregations

BufferedReader (java.io.BufferedReader)1 IOException (java.io.IOException)1 Location (org.apache.metron.dataloads.nonbulk.flatfile.location.Location)1