private Map<String, List<String>> drain(Cursor cur) throws IOException { try { Map<String, List<String>> entries = new TreeMap<>(); while (cur.next()) { Location location = cur.getLocation(); try (Scanner scanner = new Scanner(cur.openResource(), "UTF-8")) { List<String> contents = new ArrayList<>(); while (scanner.hasNextLine()) { String line = scanner.nextLine(); contents.add(line); } entries.put(location.toPath('/'), contents); } } return entries; } finally { cur.close(); } }
@Override public File getOutputFile(Location location) { return new File(getBaseDirectory(), location.toPath(File.separatorChar)); }