WildcardFilter (Commons IO 2.5)
Date: 2016-12-01

org.apache.commons.io.filefilter

## Class WildcardFilter

- java.lang.Object
- - org.apache.commons.io.filefilter.AbstractFileFilter
  - - org.apache.commons.io.filefilter.WildcardFilter

- All Implemented Interfaces:
    java.io.FileFilter, java.io.FilenameFilter, java.io.Serializable, IOFileFilter

  Deprecated.
  Use WilcardFileFilter. Deprecated as this class performs directory filtering which it shouldn't do, but that can't be removed due to compatability.

      @Deprecated
      public class WildcardFilter
      extends AbstractFileFilter
      implements java.io.Serializable

  Filters files using the supplied wildcards.

  This filter selects files, but not directories, based on one or more wildcards and using case-sensitive comparison.

  The wildcard matcher uses the characters '?' and '*' to represent a single or multiple wildcard characters. This is the same as often found on Dos/Unix command lines. The extension check is case-sensitive. See `FilenameUtils.wildcardMatch(String, String)` for more information.

  For example:

       File dir = new File(".");
       FileFilter fileFilter = new WildcardFilter("*test*.java~*~");
       File[] files = dir.listFiles(fileFilter);
       for (int i = 0; i < files.length; i++) {
         System.out.println(files[i]);
       }

  Since:
    1.1
  Version:
    $Id: WildcardFilter.java 1642757 2014-12-01 21:09:30Z sebb $
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private static long` | `serialVersionUID` Deprecated.
    `private java.lang.String[]` | `wildcards` Deprecated. The wildcards that will be used to match filenames.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `WildcardFilter(java.util.List<java.lang.String> wildcards)` Deprecated. Construct a new case-sensitive wildcard filter for a list of wildcards.
    `WildcardFilter(java.lang.String wildcard)` Deprecated. Construct a new case-sensitive wildcard filter for a single wildcard.
    `WildcardFilter(java.lang.String[] wildcards)` Deprecated. Construct a new case-sensitive wildcard filter for an array of wildcards.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `accept(java.io.File file)` Deprecated. Checks to see if the filename matches one of the wildcards.
    `boolean` | `accept(java.io.File dir, java.lang.String name)` Deprecated. Checks to see if the filename matches one of the wildcards.

    - ### Methods inherited from class org.apache.commons.io.filefilter.AbstractFileFilter

      `toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### serialVersionUID

          private static final long serialVersionUID

      Deprecated.
      See Also:
        Constant Field Values

    - #### wildcards

          private final java.lang.String[] wildcards

      Deprecated.
      The wildcards that will be used to match filenames.

  - ### Constructor Detail

    - #### WildcardFilter

          public WildcardFilter(java.lang.String wildcard)

      Deprecated.
      Construct a new case-sensitive wildcard filter for a single wildcard.
      Parameters:
        `wildcard` - the wildcard to match
      Throws:
        `java.lang.IllegalArgumentException` - if the pattern is null

    - #### WildcardFilter

          public WildcardFilter(java.lang.String[] wildcards)

      Deprecated.
      Construct a new case-sensitive wildcard filter for an array of wildcards.
      Parameters:
        `wildcards` - the array of wildcards to match
      Throws:
        `java.lang.IllegalArgumentException` - if the pattern array is null

    - #### WildcardFilter

          public WildcardFilter(java.util.List<java.lang.String> wildcards)

      Deprecated.
      Construct a new case-sensitive wildcard filter for a list of wildcards.
      Parameters:
        `wildcards` - the list of wildcards to match
      Throws:
        `java.lang.IllegalArgumentException` - if the pattern list is null
        `java.lang.ClassCastException` - if the list does not contain Strings

  - ### Method Detail

    - #### accept

          public boolean accept(java.io.File dir,
                       java.lang.String name)

      Deprecated.
      Checks to see if the filename matches one of the wildcards.
      Specified by:
        `accept` in interface `java.io.FilenameFilter`
      Specified by:
        `accept` in interface `IOFileFilter`
      Overrides:
        `accept` in class `AbstractFileFilter`
      Parameters:
        `dir` - the file directory
        `name` - the filename
      Returns:
        true if the filename matches one of the wildcards

    - #### accept

          public boolean accept(java.io.File file)

      Deprecated.
      Checks to see if the filename matches one of the wildcards.
      Specified by:
        `accept` in interface `java.io.FileFilter`
      Specified by:
        `accept` in interface `IOFileFilter`
      Overrides:
        `accept` in class `AbstractFileFilter`
      Parameters:
        `file` - the file to check
      Returns:
        true if the filename matches one of the wildcards

Copyright (c) 2002-2016 Apache Software Foundation