public DirectoryLines(String basepath, String namePattern) { this.basepath = basepath; this.namePattern = Pattern.compile(namePattern); allFiles = getAllFiles(); if (allFiles.size() == 0) { throw new RuntimeException("Loaded zero files from " + basepath + ", full path:" + Paths.get(basepath).getFileName()); } pathIterator = allFiles.iterator(); try { stringIterator = Files.readAllLines(pathIterator.next()).iterator(); } catch (IOException e) { throw new RuntimeException(e); } }
@Example({"DirectoryLines('/var/tmp/bardata', '.*')","load every line from every file in /var/tmp/bardata"}) public DirectoryLines(String basepath, String namePattern) { this.basepath = basepath; this.namePattern = Pattern.compile(namePattern); allFiles = getAllFiles(); if (allFiles.size() == 0) { throw new RuntimeException("Loaded zero files from " + basepath + ", full path:" + Paths.get(basepath).getFileName()); } pathIterator = allFiles.iterator(); try { stringIterator = Files.readAllLines(pathIterator.next()).iterator(); } catch (IOException e) { throw new RuntimeException(e); } }
@Example({"DirectoryLines('/var/tmp/bardata', '.*')","load every line from every file in /var/tmp/bardata"}) public DirectoryLines(String basepath, String namePattern) { this.basepath = basepath; this.namePattern = Pattern.compile(namePattern); allFiles = getAllFiles(); if (allFiles.size() == 0) { throw new RuntimeException("Loaded zero files from " + basepath + ", full path:" + Paths.get(basepath).getFileName()); } pathIterator = allFiles.iterator(); try { stringIterator = Files.readAllLines(pathIterator.next()).iterator(); } catch (IOException e) { throw new RuntimeException(e); } }