}
private FileVisitResult walk(final Path file, final int depth)
throws IOException {
IOException exc = null;
BasicFileAttributes attrs = null;
try {
attrs = Files.readAttributes(file, BasicFileAttributes.class);
} catch (IOException ex) {
exc = ex;
}
if (exc != null) {
return visitor.visitFileFailed(file, exc);
}
// at maximum depth or file is not a directory
if (depth >= maxDepth || !attrs.isDirectory()) {
return visitor.visitFile(file, attrs);
}
DirectoryStream<? extends Path> stream = null;
FileVisitResult result = null;