public class CountingPathVisitor extends SimplePathVisitor
Constructor and Description |
---|
CountingPathVisitor(Counters.PathCounters pathCounter)
Constructs a new instance.
|
CountingPathVisitor(Counters.PathCounters pathCounter,
PathFilter fileFilter,
PathFilter dirFilter)
Constructs a new instance.
|
CountingPathVisitor(Counters.PathCounters pathCounter,
PathFilter fileFilter,
PathFilter dirFilter,
IOBiFunction<Path,IOException,FileVisitResult> visitFileFailed)
Constructs a new instance.
|
Modifier and Type | Method and Description |
---|---|
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()
Creates a new instance configured with a
BigInteger Counters.PathCounters . |
static CountingPathVisitor |
withLongCounters()
Creates a new instance configured with a
long Counters.PathCounters . |
visitFileFailed
public CountingPathVisitor(Counters.PathCounters pathCounter)
pathCounter
- How to count path visits.public CountingPathVisitor(Counters.PathCounters pathCounter, PathFilter fileFilter, PathFilter dirFilter)
pathCounter
- How to count path visits.fileFilter
- Filters which files to count.dirFilter
- Filters which directories to count.public CountingPathVisitor(Counters.PathCounters pathCounter, PathFilter fileFilter, PathFilter dirFilter, IOBiFunction<Path,IOException,FileVisitResult> visitFileFailed)
pathCounter
- How to count path visits.fileFilter
- Filters which files to count.dirFilter
- Filters which directories to count.visitFileFailed
- Called on SimplePathVisitor.visitFileFailed(Path, IOException)
.public static CountingPathVisitor withBigIntegerCounters()
BigInteger
Counters.PathCounters
.BigInteger
Counters.PathCounters
.public static CountingPathVisitor withLongCounters()
long
Counters.PathCounters
.long
Counters.PathCounters
.public Counters.PathCounters getPathCounters()
public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException
postVisitDirectory
in interface FileVisitor<Path>
postVisitDirectory
in class SimpleFileVisitor<Path>
IOException
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attributes) throws IOException
preVisitDirectory
in interface FileVisitor<Path>
preVisitDirectory
in class SimpleFileVisitor<Path>
IOException
protected 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>
IOException
Copyright © 2002–2023 The Apache Software Foundation. All rights reserved.