public class PatternFileSelector extends java.lang.Object implements FileSelector
FileSelector that selects based on regular expressions.
The regular expression specified in one of the constructors is
matched against FileName.getPath()
of all candidate files. If you want to match only against the base file name,
make sure to prefix the pattern with ".\*\/".
| Modifier and Type | Field and Description |
|---|---|
private java.util.regex.Pattern |
pattern
The extensions to select.
|
| Constructor and Description |
|---|
PatternFileSelector(java.util.regex.Pattern pattern)
Creates a new selector for the given pattern.
|
PatternFileSelector(java.lang.String regex)
Creates a new selector for the given pattern.
|
PatternFileSelector(java.lang.String regex,
int flags)
Creates a new selector for the given Pattern and flags.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
includeFile(FileSelectInfo fileInfo)
Determines if a file or folder should be selected.
|
java.lang.String |
toString() |
boolean |
traverseDescendents(FileSelectInfo fileInfo)
Determines whether a folder should be traversed.
|
public PatternFileSelector(java.util.regex.Pattern pattern)
See PatternFileSelector for a specification how the pattern is matched.
pattern - The regular expressed used by this selector.public PatternFileSelector(java.lang.String regex)
See PatternFileSelector for a specification how the pattern is matched.
regex - The regular expressed used by this selector.Pattern.compile(String, int)public PatternFileSelector(java.lang.String regex,
int flags)
See PatternFileSelector for a specification how the pattern is matched.
regex - The expression to be compiledflags - Match flags, a bit mask.Pattern.compile(String, int)public boolean includeFile(FileSelectInfo fileInfo) throws java.lang.Exception
See PatternFileSelector for a specification how the pattern is matched.
includeFile in interface FileSelectorfileInfo - The file selection information.java.lang.Exception - if an error occurs.public java.lang.String toString()
toString in class java.lang.Objectpublic boolean traverseDescendents(FileSelectInfo fileInfo) throws java.lang.Exception
This implementation always returns true to make sure all leafs are inspected.
traverseDescendents in interface FileSelectorfileInfo - The file selection information.java.lang.Exception - if an error occurs.