Class AccumulatorPathVisitor

All Implemented Interfaces:
FileVisitor<Path>, PathVisitor

Accumulates normalized paths during visitation.

Use with care on large file trees as each visited Path element is remembered.

Example

 Path dir = PathUtils.current();
 // We are interested in files older than one day
 Instant cutoff = Instant.now().minus(Duration.ofDays(1));
 AccumulatorPathVisitor visitor = AccumulatorPathVisitor.withLongCounters(new AgeFileFilter(cutoff));
 //
 // Walk one dir
 Files.walkFileTree(dir, Collections.emptySet(), 1, visitor);
 System.out.println(visitor.getPathCounters());
 System.out.println(visitor.getFileList());
 //
 visitor.getPathCounters().reset();
 //
 // Walk dir tree
 Files.walkFileTree(dir, visitor);
 System.out.println(visitor.getPathCounters());
 System.out.println(visitor.getDirList());
 System.out.println(visitor.getFileList());
 
Since:
2.7