public class AccumulatorPathVisitor extends CountingPathVisitor
Use with care on large file trees as each visited Path element is remembered.
Constructor and Description |
---|
AccumulatorPathVisitor(Counters.PathCounters pathCounter)
Constructs a new instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
List<Path> |
getDirList()
Gets the list of visited directories.
|
List<Path> |
getFileList()
Gets the list of visited files.
|
int |
hashCode() |
List<Path> |
relativizeDirectories(Path parent,
boolean sort,
Comparator<? super Path> comparator)
Relativizes each directory path with
Path.relativize(Path) against the given parent , optionally
sorting the result. |
List<Path> |
relativizeFiles(Path parent,
boolean sort,
Comparator<? super Path> comparator)
Relativizes each file path with
Path.relativize(Path) against the given parent , optionally
sorting the result. |
FileVisitResult |
visitFile(Path file,
BasicFileAttributes attributes) |
static AccumulatorPathVisitor |
withBigIntegerCounters()
Creates a new instance configured with a BigInteger
Counters.PathCounters . |
static AccumulatorPathVisitor |
withLongCounters()
Creates a new instance configured with a long
Counters.PathCounters . |
getPathCounters, postVisitDirectory, toString
preVisitDirectory, visitFileFailed
public AccumulatorPathVisitor(Counters.PathCounters pathCounter)
pathCounter
- How to count path visits.public static AccumulatorPathVisitor withBigIntegerCounters()
Counters.PathCounters
.Counters.PathCounters
.public static AccumulatorPathVisitor withLongCounters()
Counters.PathCounters
.Counters.PathCounters
.public boolean equals(Object obj)
equals
in class CountingPathVisitor
public List<Path> getDirList()
public List<Path> getFileList()
public int hashCode()
hashCode
in class CountingPathVisitor
public List<Path> relativizeDirectories(Path parent, boolean sort, Comparator<? super Path> comparator)
Path.relativize(Path)
against the given parent
, optionally
sorting the result.parent
- A parent pathsort
- Whether to sortcomparator
- How to sort, null uses default sorting.public List<Path> relativizeFiles(Path parent, boolean sort, Comparator<? super Path> comparator)
Path.relativize(Path)
against the given parent
, optionally
sorting the result.parent
- A parent pathsort
- Whether to sortcomparator
- How to sort, null uses default sorting.public FileVisitResult visitFile(Path file, BasicFileAttributes attributes) throws IOException
visitFile
in interface FileVisitor<Path>
visitFile
in class CountingPathVisitor
IOException
Jas4pp 1.5 © Java Analysis Studio for Particle Physics