public class CountingPathVisitor extends SimplePathVisitor
Constructor and Description |
---|
CountingPathVisitor(Counters.PathCounters pathCounter)
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) |
String |
toString() |
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 . |
preVisitDirectory, visitFileFailed
public CountingPathVisitor(Counters.PathCounters pathCounter)
pathCounter
- How to count path visits.public static CountingPathVisitor withBigIntegerCounters()
Counters.PathCounters
.Counters.PathCounters
.public static CountingPathVisitor withLongCounters()
Counters.PathCounters
.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
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–2020 The Apache Software Foundation. All rights reserved.