java.util.function.Predicate<java.nio.file.Path>
public static class PathWatcher.Config
extends java.lang.Object
implements java.util.function.Predicate<java.nio.file.Path>
Modifier and Type | Field | Description |
---|---|---|
protected boolean |
excludeHidden |
|
protected IncludeExcludeSet<java.nio.file.PathMatcher,java.nio.file.Path> |
includeExclude |
|
protected PathWatcher.Config |
parent |
|
protected java.nio.file.Path |
path |
|
protected long |
pauseUntil |
|
protected int |
recurseDepth |
|
static int |
UNLIMITED_DEPTH |
Constructor | Description |
---|---|
Config(java.nio.file.Path path) |
|
Config(java.nio.file.Path path,
PathWatcher.Config parent) |
Modifier and Type | Method | Description |
---|---|---|
void |
addExclude(java.lang.String syntaxAndPattern) |
Add an exclude PathMatcher.
|
void |
addExclude(java.nio.file.PathMatcher matcher) |
Add an exclude PathMatcher
|
void |
addExcludeGlobRelative(java.lang.String pattern) |
Add a
glob: syntax pattern exclude reference in a directory relative, os neutral, pattern. |
void |
addExcludeHidden() |
Exclude hidden files and hidden directories
|
void |
addExcludes(java.util.List<java.lang.String> syntaxAndPatterns) |
Add multiple exclude PathMatchers
|
void |
addInclude(java.lang.String syntaxAndPattern) |
Add an include PathMatcher
|
void |
addInclude(java.nio.file.PathMatcher matcher) |
Add an include PathMatcher
|
void |
addIncludeGlobRelative(java.lang.String pattern) |
Add a
glob: syntax pattern reference in a directory relative, os neutral, pattern. |
void |
addIncludes(java.util.List<java.lang.String> syntaxAndPatterns) |
Add multiple include PathMatchers
|
PathWatcher.Config |
asSubConfig(java.nio.file.Path dir) |
Build a new config from a this configuration.
|
PathWatcher.Config |
getParent() |
|
java.nio.file.Path |
getPath() |
|
int |
getRecurseDepth() |
|
boolean |
isHidden(java.nio.file.Path path) |
|
boolean |
isPaused(long now) |
|
boolean |
isRecurseDepthUnlimited() |
|
java.nio.file.Path |
resolve(java.nio.file.Path path) |
|
void |
setPauseUntil(long time) |
|
void |
setRecurseDepth(int depth) |
Set the recurse depth for the directory scanning.
|
boolean |
test(java.nio.file.Path path) |
|
java.lang.String |
toShortPath(java.nio.file.Path path) |
|
java.lang.String |
toString() |
public static final int UNLIMITED_DEPTH
protected final PathWatcher.Config parent
protected final java.nio.file.Path path
protected final IncludeExcludeSet<java.nio.file.PathMatcher,java.nio.file.Path> includeExclude
protected int recurseDepth
protected boolean excludeHidden
protected long pauseUntil
public Config(java.nio.file.Path path)
public Config(java.nio.file.Path path, PathWatcher.Config parent)
public PathWatcher.Config getParent()
public void setPauseUntil(long time)
public boolean isPaused(long now)
public void addExclude(java.nio.file.PathMatcher matcher)
matcher
- the path matcher for this excludepublic void addExclude(java.lang.String syntaxAndPattern)
Note: this pattern is FileSystem specific (so use "/" for Linux and OSX, and "\\" for Windows)
syntaxAndPattern
- the PathMatcher syntax and pattern to usefor detail on syntax and pattern
public void addExcludeGlobRelative(java.lang.String pattern)
glob:
syntax pattern exclude reference in a directory relative, os neutral, pattern.
On Linux: Config config = new Config(Path("/home/user/example")); config.addExcludeGlobRelative("*.war") => "glob:/home/user/example/*.war" On Windows Config config = new Config(Path("D:/code/examples")); config.addExcludeGlobRelative("*.war") => "glob:D:\\code\\examples\\*.war"
pattern
- the pattern, in unixy format, relative to config.dirpublic void addExcludeHidden()
public void addExcludes(java.util.List<java.lang.String> syntaxAndPatterns)
syntaxAndPatterns
- the list of PathMatcher syntax and patterns to usefor detail on syntax and pattern
public void addInclude(java.nio.file.PathMatcher matcher)
matcher
- the path matcher for this includepublic void addInclude(java.lang.String syntaxAndPattern)
syntaxAndPattern
- the PathMatcher syntax and pattern to usefor detail on syntax and pattern
public void addIncludeGlobRelative(java.lang.String pattern)
glob:
syntax pattern reference in a directory relative, os neutral, pattern.
On Linux: Config config = new Config(Path("/home/user/example")); config.addIncludeGlobRelative("*.war") => "glob:/home/user/example/*.war" On Windows Config config = new Config(Path("D:/code/examples")); config.addIncludeGlobRelative("*.war") => "glob:D:\\code\\examples\\*.war"
pattern
- the pattern, in unixy format, relative to config.dirpublic void addIncludes(java.util.List<java.lang.String> syntaxAndPatterns)
syntaxAndPatterns
- the list of PathMatcher syntax and patterns to usefor detail on syntax and pattern
public PathWatcher.Config asSubConfig(java.nio.file.Path dir)
Useful for working with sub-directories that also need to be watched.
dir
- the directory to build new Config from (using this config as source of includes/excludes)public int getRecurseDepth()
public boolean isRecurseDepthUnlimited()
public java.nio.file.Path getPath()
public java.nio.file.Path resolve(java.nio.file.Path path)
public boolean test(java.nio.file.Path path)
test
in interface java.util.function.Predicate<java.nio.file.Path>
public void setRecurseDepth(int depth)
-999 indicates arbitrarily deep recursion, 0 indicates no recursion, 1 is only one directory deep, and so on.
depth
- the number of directories deep to recursepublic boolean isHidden(java.nio.file.Path path)
public java.lang.String toShortPath(java.nio.file.Path path)
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 1995–2018 Webtide. All rights reserved.