public class DirectoryWalker extends Object
| Constructor and Description |
|---|
DirectoryWalker(Path rootDir)
Initialize with a root directory to walk.
|
| Modifier and Type | Method and Description |
|---|---|
DirectoryWalker |
filter(Predicate<Path> pathFilter)
Adds a filter to the walked paths.
|
DirectoryWalker |
filterRoot()
Filters away the
rootDir. |
com.google.common.collect.ImmutableList<Path> |
walk()
Walks
rootDir. |
com.google.common.collect.ImmutableList<Path> |
walk(PathConsumer pathConsumer)
Walks
rootDir and applies pathConsumer to each file. |
public DirectoryWalker(Path rootDir) throws NotDirectoryException
rootDir - the root directory.NotDirectoryException - if the root directory is not a directory.public DirectoryWalker filter(Predicate<Path> pathFilter)
pathFilter - the filter. pathFilter returns true if the path should be
accepted and false otherwise.public DirectoryWalker filterRoot()
rootDir.public com.google.common.collect.ImmutableList<Path> walk(PathConsumer pathConsumer) throws IOException
pathConsumer - the consumer that is applied to each file.IOException - if the walk fails.public com.google.common.collect.ImmutableList<Path> walk() throws IOException
rootDir.IOException - if walking the files fails.Copyright © 2019. All rights reserved.