Package org.apache.commons.vfs2
Class FileExtensionSelector
java.lang.Object
org.apache.commons.vfs2.FileExtensionSelector
- All Implemented Interfaces:
FileSelector
A
FileSelector that selects based on file extensions.
The extension comparison is case insensitive.
The selector makes a copy of a given Collection or array. Changing the object passed in the constructors will not affect the selector.
- Since:
- 2.1
-
Constructor Summary
ConstructorsConstructorDescriptionFileExtensionSelector(String... extensions) Creates a new selector for the given extensions.FileExtensionSelector(Collection<String> extensions) Creates a new selector for the given extensions. -
Method Summary
Modifier and TypeMethodDescriptionbooleanincludeFile(FileSelectInfo fileInfo) Determines if a file or folder should be selected.booleantraverseDescendents(FileSelectInfo fileInfo) Determines whether a folder should be traversed.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.commons.vfs2.FileSelector
traverseDescendants
-
Constructor Details
-
FileExtensionSelector
Creates a new selector for the given extensions.- Parameters:
extensions- The extensions to be included by this selector.
-
FileExtensionSelector
Creates a new selector for the given extensions.- Parameters:
extensions- The extensions to be included by this selector.
-
-
Method Details
-
includeFile
Determines if a file or folder should be selected.- Specified by:
includeFilein interfaceFileSelector- Parameters:
fileInfo- The file selection information.- Returns:
- true if the file should be selected, false otherwise.
- Throws:
Exception- if an error occurs.
-
traverseDescendents
Determines whether a folder should be traversed.- Specified by:
traverseDescendentsin interfaceFileSelector- Parameters:
fileInfo- The file selection information.- Returns:
- true if descendants should be traversed, false otherwise.
- Throws:
Exception- if an error occurs.
-