public class DualPathPredicates extends Object
Predicate<Path
for both a file and a directory.Constructor and Description |
---|
DualPathPredicates(CheckedPredicate<Path,IOException> file,
CheckedPredicate<Path,IOException> directory) |
Modifier and Type | Method and Description |
---|---|
void |
consumeMatchingFiles(List<Path> paths,
java.util.function.Consumer<File> consumerMatching)
Calls a
Consumer on any path that matches the predicate file . |
CheckedPredicate<Path,IOException> |
getDirectory()
Only accepts any containing directories where the predicate returns true
|
boolean |
matchFile(Path path)
Whether the path to a particular file matches the predicate
file ? |
List<Path> |
matchingLeafDirectories(List<Path> leafDirectories)
Creates a new list of paths to leaf-directories that match the predicate
directory . |
public DualPathPredicates(CheckedPredicate<Path,IOException> file, CheckedPredicate<Path,IOException> directory)
public boolean matchFile(Path path) throws IOException
file
?path
- the path.IOException
- if an error occurs testing the path.public void consumeMatchingFiles(List<Path> paths, java.util.function.Consumer<File> consumerMatching) throws FindFilesException
Consumer
on any path that matches the predicate file
.paths
- the paths to test.consumerMatching
- the consumer to call if a path matches.FindFilesException
- if an error occurs testing a path.public List<Path> matchingLeafDirectories(List<Path> leafDirectories) throws FindFilesException
directory
.leafDirectories
- the paths to the directories to consider.leafDirectories
that match
directory
.FindFilesException
- if an error occurs testing a path.public CheckedPredicate<Path,IOException> getDirectory()
Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.