Directory Recursive Visitor
Walk a File Tree using a Java NIO Visitor.
Javadoc available at https://www.javatapas.com/docs/javatapas/io/DirectoryRecursiveVisitor.html
private List<T> list = new ArrayList<T>();
public List<T> getList(){return this.list;}
public FileVisitResult preVisitDirectory(T dir, BasicFileAttributes attrs) throws IOException
{
System.out.println("Starting preVisitDirectory in " + dir.toString());
return FileVisitResult.CONTINUE;
}
public FileVisitResult visitFile(T file, BasicFileAttributes attrs) throws IOException
{
System.out.println("Currently on file: " + file.toString());
if (attrs.isRegularFile()){this.list.add(file);}
return FileVisitResult.CONTINUE;
}
public FileVisitResult postVisitDirectory(T dir, IOException e) throws IOException
{
System.out.println("Completed postVisitDirectory in " + dir.toString());
return FileVisitResult.CONTINUE;
}