Class DefaultFilenameFilter

  • All Implemented Interfaces:
    FilenameFilter

    public class DefaultFilenameFilter
    extends Object
    implements FilenameFilter
    Implements a default filename filter that supports filtering by wild-cards like ("myFile*.*").
    • Constructor Detail

      • DefaultFilenameFilter

        public DefaultFilenameFilter​(String pattern,
                                     boolean caseSensitive)
        Creates a new DefaultFilenameFilter object for a given pattern.
        Parameters:
        pattern - to filter on.
        caseSensitive - true to use case-sensitive pattern, false otherwise. You can use ? to match any single character and * to match any multiple characters. The pattern is not case-sensitive ("test.*" and "TeSt.*" give the same results) except if specified otherwise.
      • DefaultFilenameFilter

        public DefaultFilenameFilter​(String extension)
        Creates a new DefaultFilenameFilter object with a given extension value. This constructor is for backward compatibility and is equivalent to calling DefaultFilenameFilter("*"+extension, false)
        Parameters:
        extension - the extension to filter on.
    • Method Detail

      • accept

        public boolean accept​(File directory,
                              String fileName)
        Accept or reject a given filename.
        Specified by:
        accept in interface FilenameFilter
        Returns:
        true if the filename is accepted. If the value is null, the method returns false.