public class PathFilter extends Object implements java.nio.file.DirectoryStream.Filter<java.nio.file.Path>, FileFilter
Constructor and Description |
---|
PathFilter(String[] exclude_globs,
Pattern[] exclude_regex,
boolean follow,
boolean hidden)
Create a new filter based on the given arguments.
|
PathFilter(String[] globs,
String[] regex,
boolean follow,
boolean hidden)
Create a new filter based on the given arguments.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(File file) |
boolean |
accept(java.nio.file.Path entry) |
boolean |
followSymlinks()
Check, whether symlinks should be followed to the final destination.
|
boolean |
useFiles()
Check, whether one should use
File to obtain a directory listing. |
public PathFilter(String[] globs, String[] regex, boolean follow, boolean hidden)
globs
- globbing patterns for pathnames to ignore. Might be
null
, but must NOT contain null
or invalid entries.regex
- regex patterns for pathnames to ignore. Might be
null
, but must NOT contain null
or invalid entries.follow
- if true
follow symlinkshidden
- if true
ignore hidden entries as wellpublic PathFilter(String[] exclude_globs, Pattern[] exclude_regex, boolean follow, boolean hidden)
exclude_globs
- globbing patterns for pathnames to ignore. Might
be null
, but must NOT contain null
or invalid entries.exclude_regex
- regex patterns for pathnames to ignore. Might be
null
, but must NOT contain null
entries.follow
- if true
follow symlinkshidden
- if true
ignore hidden entries as wellpublic boolean useFiles()
File
to obtain a directory listing.
Default is false
, i.e. use the nio
Files#newDirectoryStream(Path, Filter)
directory scanner instead.
It has no influence the filter itself, it is just a convinient central
place to store this property. It gets determined by the System property
dir.stream.bug
, which should be "true"
if the traditional
File interface should be used.true
if traditional File
interface should be used.public boolean followSymlinks()
true
if symlinks should be resolved.public boolean accept(java.nio.file.Path entry)
accept
in interface java.nio.file.DirectoryStream.Filter<java.nio.file.Path>
public boolean accept(File file)
accept
in interface FileFilter
Created by Jens Elkner