public class CountingPathVisitor extends SimplePathVisitor
| Modifier and Type | Class and Description |
|---|---|
static class |
CountingPathVisitor.AbstractBuilder<T,B extends CountingPathVisitor.AbstractBuilder<T,B>>
Builds instances of
CountingPathVisitor. |
static class |
CountingPathVisitor.Builder
Builds instances of
CountingPathVisitor. |
| Modifier and Type | Field and Description |
|---|---|
(package private) static String[] |
EMPTY_STRING_ARRAY |
| Constructor and Description |
|---|
CountingPathVisitor(Counters.PathCounters pathCounters)
Constructs a new instance.
|
CountingPathVisitor(Counters.PathCounters pathCounters,
PathFilter fileFilter,
PathFilter directoryFilter)
Constructs a new instance.
|
CountingPathVisitor(CountingPathVisitor.AbstractBuilder<?,?> builder) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
accept(Path file,
BasicFileAttributes attributes)
Tests whether the given file is accepted by the file filter.
|
(package private) static IOFileFilter |
defaultDirectoryFilter() |
(package private) static java.util.function.UnaryOperator<Path> |
defaultDirectoryTransformer() |
(package private) static IOFileFilter |
defaultFileFilter() |
(package private) static Counters.PathCounters |
defaultPathCounters() |
boolean |
equals(Object obj) |
Counters.PathCounters |
getPathCounters()
Gets the visitation counts.
|
int |
hashCode() |
FileVisitResult |
postVisitDirectory(Path dir,
IOException exc) |
FileVisitResult |
preVisitDirectory(Path dir,
BasicFileAttributes attributes) |
String |
toString() |
protected void |
updateDirCounter(Path dir,
IOException exc)
Updates the counter for visiting the given directory.
|
protected void |
updateFileCounters(Path file,
BasicFileAttributes attributes)
Updates the counters for visiting the given file.
|
FileVisitResult |
visitFile(Path file,
BasicFileAttributes attributes) |
static CountingPathVisitor |
withBigIntegerCounters()
Constructs a new instance configured with a
BigInteger Counters.PathCounters. |
static CountingPathVisitor |
withLongCounters()
Constructs a new instance configured with a
long Counters.PathCounters. |
visitFileFailedstatic final String[] EMPTY_STRING_ARRAY
public CountingPathVisitor(Counters.PathCounters pathCounters)
pathCounters - How to count path visits.CountingPathVisitor.Builderpublic CountingPathVisitor(Counters.PathCounters pathCounters, PathFilter fileFilter, PathFilter directoryFilter)
pathCounters - How to count path visits.fileFilter - Filters which files to count.directoryFilter - Filters which directories to count.CountingPathVisitor.BuilderCountingPathVisitor(CountingPathVisitor.AbstractBuilder<?,?> builder)
protected boolean accept(Path file, BasicFileAttributes attributes)
file - the visited file.attributes - the visited file attributes.static IOFileFilter defaultDirectoryFilter()
static java.util.function.UnaryOperator<Path> defaultDirectoryTransformer()
static IOFileFilter defaultFileFilter()
static Counters.PathCounters defaultPathCounters()
public Counters.PathCounters getPathCounters()
public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException
postVisitDirectory in interface FileVisitor<Path>postVisitDirectory in class SimpleFileVisitor<Path>IOExceptionpublic FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attributes) throws IOException
preVisitDirectory in interface FileVisitor<Path>preVisitDirectory in class SimpleFileVisitor<Path>IOExceptionprotected void updateDirCounter(Path dir, IOException exc)
dir - the visited directory.exc - Encountered exception.protected void updateFileCounters(Path file, BasicFileAttributes attributes)
file - the visited file.attributes - the visited file attributes.public FileVisitResult visitFile(Path file, BasicFileAttributes attributes) throws IOException
visitFile in interface FileVisitor<Path>visitFile in class SimpleFileVisitor<Path>IOExceptionpublic static CountingPathVisitor withBigIntegerCounters()
BigInteger Counters.PathCounters.BigInteger Counters.PathCounters.public static CountingPathVisitor withLongCounters()
long Counters.PathCounters.long Counters.PathCounters.