Package rma.util

Class WildCardFileFilter

java.lang.Object
rma.util.WildCardFileFilter
All Implemented Interfaces:
FilenameFilter

public class WildCardFileFilter extends Object implements FilenameFilter
An implementation of the FileFilter interfaces that filters files based on a file name pattern. The file name patterns are case-insensitive and make use of the ? and * wildcard characters.
  • Constructor Details

    • WildCardFileFilter

      public WildCardFileFilter(String s)
      Creates a new WildCardFileFilter with the provided pattern. The toMinimalPattern() method is implicitly called on the provided pattern.
  • Method Details

    • getPattern

      public char[] getPattern()
    • setPattern

      public void setPattern(String s)
    • setAcceptDirectories

      public void setAcceptDirectories(boolean b)
    • accept

      public boolean accept(File dir, String file)
      Tests if a specified file should be included in a file list.
      Specified by:
      accept in interface FilenameFilter
    • toMinimalPattern

      public static String toMinimalPattern(String s)
      Converts the provided pattern to it's minimum equivalent. Basically this method converts all touching *'s to a single *.
    • match

      public static boolean match(String pattern, String fileName)
      Checks to see if a provided file name matches the provided pattern.