Class PatternFileSelector
java.lang.Object
org.apache.commons.vfs2.PatternFileSelector
- All Implemented Interfaces:
- FileSelector
A 
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 ".*\\/".
 
- Since:
- 2.1
- 
Constructor SummaryConstructorsConstructorDescriptionPatternFileSelector(String regex) Creates a new selector for the given pattern.PatternFileSelector(String regex, int flags) Creates a new selector for the given Pattern and flags.PatternFileSelector(Pattern pattern) Creates a new selector for the given pattern.
- 
Method SummaryModifier and TypeMethodDescriptionbooleanincludeFile(FileSelectInfo fileInfo) Determines if a file or folder should be selected.toString()booleantraverseDescendents(FileSelectInfo fileInfo) Determines whether a folder should be traversed.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.commons.vfs2.FileSelectortraverseDescendants
- 
Constructor Details- 
PatternFileSelectorCreates a new selector for the given pattern.See PatternFileSelectorfor a specification how the pattern is matched.- Parameters:
- pattern- The regular expressed used by this selector.
 
- 
PatternFileSelectorCreates a new selector for the given pattern.See PatternFileSelectorfor a specification how the pattern is matched.- Parameters:
- regex- The regular expressed used by this selector.
- See Also:
 
- 
PatternFileSelectorCreates a new selector for the given Pattern and flags.See PatternFileSelectorfor a specification how the pattern is matched.- Parameters:
- regex- The expression to be compiled
- flags- Match flags, a bit mask.
- See Also:
 
 
- 
- 
Method Details- 
includeFileDetermines if a file or folder should be selected.See PatternFileSelectorfor a specification how the pattern is matched.- Specified by:
- includeFilein interface- FileSelector
- Parameters:
- fileInfo- The file selection information.
- Returns:
- true if the file should be selected, false otherwise.
- Throws:
- Exception- if an error occurs.
 
- 
toString
- 
traverseDescendentsDetermines whether a folder should be traversed.This implementation always returns true to make sure all leafs are inspected. - Specified by:
- traverseDescendentsin interface- FileSelector
- Parameters:
- fileInfo- The file selection information.
- Returns:
- true if descendants should be traversed, false otherwise.
- Throws:
- Exception- if an error occurs.
 
 
-