use of org.batfish.common.Directory in project batfish by batfish.
the class Batfish method readFiles.
private SortedMap<Path, String> readFiles(Path directory, String description) {
_logger.infof("\n*** READING FILES: %s ***\n", description);
_logger.resetTimer();
SortedMap<Path, String> fileData = new TreeMap<>();
List<Path> filePaths;
try (Stream<Path> paths = CommonUtil.list(directory)) {
filePaths = paths.filter(path -> !path.getFileName().toString().startsWith(".")).sorted().collect(Collectors.toList());
}
AtomicInteger completed = newBatch("Reading files: " + description, filePaths.size());
for (Path file : filePaths) {
_logger.debugf("Reading: \"%s\"\n", file);
String fileTextRaw = CommonUtil.readFile(file.toAbsolutePath());
String fileText = fileTextRaw + ((fileTextRaw.length() != 0) ? "\n" : "");
fileData.put(file, fileText);
completed.incrementAndGet();
}
_logger.printElapsedTime();
return fileData;
}
use of org.batfish.common.Directory in project batfish by batfish.
the class Batfish method getTestrigFileTree.
@Override
public Directory getTestrigFileTree() {
Path trPath = _testrigSettings.getTestRigPath();
Directory dir = new Directory(trPath);
return dir;
}
Aggregations