Package org.apache.commons.vfs2
Class FileExtensionSelector
- java.lang.Object
-
- org.apache.commons.vfs2.FileExtensionSelector
-
- All Implemented Interfaces:
FileSelector
public class FileExtensionSelector extends java.lang.Object implements FileSelector
AFileSelector
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
Constructors Constructor Description FileExtensionSelector(java.lang.String... extensions)
Creates a new selector for the given extensions.FileExtensionSelector(java.util.Collection<java.lang.String> extensions)
Creates a new selector for the given extensions.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
includeFile(FileSelectInfo fileInfo)
Determines if a file or folder should be selected.boolean
traverseDescendents(FileSelectInfo fileInfo)
Determines whether a folder should be traversed.
-
-
-
Constructor Detail
-
FileExtensionSelector
public FileExtensionSelector(java.util.Collection<java.lang.String> extensions)
Creates a new selector for the given extensions.- Parameters:
extensions
- The extensions to be included by this selector.
-
FileExtensionSelector
public FileExtensionSelector(java.lang.String... extensions)
Creates a new selector for the given extensions.- Parameters:
extensions
- The extensions to be included by this selector.
-
-
Method Detail
-
includeFile
public boolean includeFile(FileSelectInfo fileInfo)
Determines if a file or folder should be selected.- Specified by:
includeFile
in interfaceFileSelector
- Parameters:
fileInfo
- The file selection information.- Returns:
- true if the file should be selected, false otherwise.
-
traverseDescendents
public boolean traverseDescendents(FileSelectInfo fileInfo)
Determines whether a folder should be traversed.- Specified by:
traverseDescendents
in interfaceFileSelector
- Parameters:
fileInfo
- The file selection information.- Returns:
- true if descendants should be traversed, fase otherwise.
-
-