Class FileExtensionSelector

java.lang.Object
org.apache.commons.vfs2.FileExtensionSelector
All Implemented Interfaces:
FileSelector

public class FileExtensionSelector extends Object implements 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 Details

    • FileExtensionSelector

      Creates a new selector for the given extensions.
      Parameters:
      extensions - The extensions to be included by this selector.
    • FileExtensionSelector

      public FileExtensionSelector(String... extensions)
      Creates a new selector for the given extensions.
      Parameters:
      extensions - The extensions to be included by this selector.
  • Method Details

    • includeFile

      public boolean includeFile(FileSelectInfo fileInfo)
      Determines if a file or folder should be selected.
      Specified by:
      includeFile in interface FileSelector
      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 interface FileSelector
      Parameters:
      fileInfo - The file selection information.
      Returns:
      true if descendants should be traversed, fase otherwise.