public final class JkPathTreeSet
extends java.lang.Object
JkPathTree
instances representing multiple
directory trees or zip file trees. Provides methods for creating, managing,
and applying operations to the collection of path trees.
Path matchers generally rely on glob patterns.
Modifier and Type | Method and Description |
---|---|
JkPathTreeSet |
and(JkPathTree... trees)
Creates a
JkPathTreeSet which is a concatenation of this
JkPathTreeSet and the JkPathTree array passed as
parameter. |
JkPathTreeSet |
and(JkPathTreeSet... otherDirSets)
Creates a
JkPathTreeSet which is a concatenation of this
JkPathTreeSet and the JkPathTreeSet array passed as
parameter. |
JkPathTreeSet |
and(java.nio.file.Path... folders)
Creates a
JkPathTreeSet which is a concatenation of this
JkPathTreeSet and the folder array passed as parameter. |
JkPathTreeSet |
andMatcher(java.nio.file.PathMatcher matcher)
|
java.lang.String |
checksum(java.lang.String algorithm) |
boolean |
containFiles() |
JkPathTreeSet |
copyTo(java.nio.file.Path dir,
java.nio.file.CopyOption... copyOptions)
Copies the content of all trees involved in this set.
|
int |
count(int max,
boolean includeFolder)
|
boolean |
equals(java.lang.Object obj) |
java.util.List<java.nio.file.Path> |
getExistingFiles(java.lang.String relativePath)
Returns a list of existing files having the specified relative path to its
JkPathTree root. |
java.util.List<java.nio.file.Path> |
getFiles()
Returns a concatenation of files for all trees involved in this set.
|
java.util.List<java.nio.file.Path> |
getRelativeFiles()
Returns a concatenation of relative paths for all trees involved in this set.
|
java.util.List<java.nio.file.Path> |
getRootDirsOrZipFiles()
Returns root dir or zip file for each
JkPathTree tree involved in this
JkPathTreeSet . |
int |
hashCode() |
boolean |
hasNoExistingRoot()
Returns
true if no tree of this set has an existing baseTree. |
JkPathTreeSet |
mergeDuplicateRoots()
Merges trees having same root by comparing their respective matcher.
|
static JkPathTreeSet |
of(java.lang.Iterable<JkPathTree> dirs)
Creates a
JkPathTreeSet from an iterable of JkPathTree . |
static JkPathTreeSet |
of(JkPathTree... trees)
Creates a
JkPathTreeSet to an array of JkPathTree . |
static JkPathTreeSet |
ofEmpty()
Creates an empty
JkPathTreeSet . |
static JkPathTreeSet |
ofRoots(java.util.List<java.nio.file.Path> paths)
Creates a
JkPathTreeSet from a JkPathSequence . |
static JkPathTreeSet |
ofRoots(java.nio.file.Path... folders)
Creates a
JkPathTreeSet from an array of folder. |
static JkPathTreeSet |
ofRoots(java.lang.String folder,
java.lang.String... folders)
Creates a
JkPathTreeSet from an array of folder paths. |
JkPathTreeSet |
resolvedTo(java.nio.file.Path newRoot) |
java.util.List<JkPathTree> |
toList()
Returns
JkPathTree instances constituting this JkPathTreeSet . |
java.lang.String |
toString() |
void |
watch(long millis,
java.util.concurrent.atomic.AtomicBoolean run,
java.util.function.Consumer<java.util.List<JkAbstractPathTree.FileChange>> fileChangeConsumer)
Same as
JkAbstractPathTree.watch(long, AtomicBoolean, Consumer) but acting on this full path tree set. |
void |
watch(long millis,
java.util.concurrent.atomic.AtomicBoolean run,
java.lang.Runnable runnable)
Same as
watch(long, AtomicBoolean, Consumer) but just triggering a consumer on file changes. |
void |
watch(long millis,
java.lang.Runnable runnable)
Same as
watch(long, AtomicBoolean, Runnable) but running indefinitely. |
JkPathTreeSet |
withMatcher(java.nio.file.PathMatcher matcher)
Creates a
JkPathTree which is a copy of this JkPathTreeSet
replacing matcher by the specified one. |
JkPathTreeSet |
zipTo(java.nio.file.Path dir)
Zips the content of all trees involved in this set.
|
public static JkPathTreeSet of(java.lang.Iterable<JkPathTree> dirs)
JkPathTreeSet
from an iterable of JkPathTree
.public static JkPathTreeSet ofEmpty()
JkPathTreeSet
.public static JkPathTreeSet of(JkPathTree... trees)
JkPathTreeSet
to an array of JkPathTree
.public static JkPathTreeSet ofRoots(java.nio.file.Path... folders)
JkPathTreeSet
from an array of folder.public static JkPathTreeSet ofRoots(java.lang.String folder, java.lang.String... folders)
JkPathTreeSet
from an array of folder paths.folders
- the array of folder pathsJkPathTreeSet
created from the folder pathspublic static JkPathTreeSet ofRoots(java.util.List<java.nio.file.Path> paths)
JkPathTreeSet
from a JkPathSequence
.public JkPathTreeSet and(JkPathTree... trees)
JkPathTreeSet
which is a concatenation of this
JkPathTreeSet
and the JkPathTree
array passed as
parameter.public JkPathTreeSet and(java.nio.file.Path... folders)
JkPathTreeSet
which is a concatenation of this
JkPathTreeSet
and the folder array passed as parameter.public JkPathTreeSet and(JkPathTreeSet... otherDirSets)
JkPathTreeSet
which is a concatenation of this
JkPathTreeSet
and the JkPathTreeSet
array passed as
parameter.public JkPathTreeSet andMatcher(java.nio.file.PathMatcher matcher)
public JkPathTreeSet withMatcher(java.nio.file.PathMatcher matcher)
JkPathTree
which is a copy of this JkPathTreeSet
replacing matcher by the specified one.public java.util.List<java.nio.file.Path> getFiles()
public java.util.List<java.nio.file.Path> getRelativeFiles()
public java.util.List<java.nio.file.Path> getExistingFiles(java.lang.String relativePath)
JkPathTree
root.public JkPathTreeSet zipTo(java.nio.file.Path dir)
public JkPathTreeSet copyTo(java.nio.file.Path dir, java.nio.file.CopyOption... copyOptions)
public java.util.List<JkPathTree> toList()
JkPathTree
instances constituting this JkPathTreeSet
.public java.util.List<java.nio.file.Path> getRootDirsOrZipFiles()
JkPathTree
tree involved in this
JkPathTreeSet
.public boolean hasNoExistingRoot()
true
if no tree of this set has an existing baseTree.public JkPathTreeSet resolvedTo(java.nio.file.Path newRoot)
JkAbstractPathTree.resolvedTo(Path)
public int count(int max, boolean includeFolder)
public boolean containFiles()
public JkPathTreeSet mergeDuplicateRoots()
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public void watch(long millis, java.util.concurrent.atomic.AtomicBoolean run, java.util.function.Consumer<java.util.List<JkAbstractPathTree.FileChange>> fileChangeConsumer)
JkAbstractPathTree.watch(long, AtomicBoolean, Consumer)
but acting on this full path tree set.public void watch(long millis, java.util.concurrent.atomic.AtomicBoolean run, java.lang.Runnable runnable)
watch(long, AtomicBoolean, Consumer)
but just triggering a consumer on file changes.public void watch(long millis, java.lang.Runnable runnable)
watch(long, AtomicBoolean, Runnable)
but running indefinitely.public java.lang.String checksum(java.lang.String algorithm)
JkAbstractPathTree.checksum(String)