org.apache.commons.io.filefilter

## Class AbstractFileFilter

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

- All Implemented Interfaces:
    FileFilter, FilenameFilter, IOFileFilter
  Direct Known Subclasses:
    AgeFileFilter, AndFileFilter, CanExecuteFileFilter, CanReadFileFilter, CanWriteFileFilter, DelegateFileFilter, DirectoryFileFilter, EmptyFileFilter, FileFileFilter, HiddenFileFilter, MagicNumberFileFilter, NameFileFilter, NotFileFilter, OrFileFilter, PrefixFileFilter, RegexFileFilter, SizeFileFilter, SuffixFileFilter, WildcardFileFilter, WildcardFilter

      public abstract class AbstractFileFilter
      extends Object
      implements IOFileFilter

  An abstract class which implements the Java FileFilter and FilenameFilter interfaces via the IOFileFilter interface.

  Note that a subclass must override one of the accept methods, otherwise your class will infinitely loop.

  Since:
    1.0

- - ### Field Summary

    - ### Fields inherited from interface org.apache.commons.io.filefilter.IOFileFilter

      `EMPTY_STRING_ARRAY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractFileFilter()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `accept(File file)` Checks to see if the File should be accepted by this filter.
    `boolean` | `accept(File dir, String name)` Checks to see if the File should be accepted by this filter.
    `String` | `toString()` Provide a String representation of this file filter.

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

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

- - ### Constructor Detail

    - #### AbstractFileFilter

          public AbstractFileFilter()

  - ### Method Detail

    - #### accept

          public boolean accept(File file)

      Checks to see if the File should be accepted by this filter.
      Specified by:
        `accept` in interface `FileFilter`
      Specified by:
        `accept` in interface `IOFileFilter`
      Parameters:
        `file` - the File to check
      Returns:
        true if this file matches the test

    - #### accept

          public boolean accept(File dir,
                                String name)

      Checks to see if the File should be accepted by this filter.
      Specified by:
        `accept` in interface `FilenameFilter`
      Specified by:
        `accept` in interface `IOFileFilter`
      Parameters:
        `dir` - the directory File to check
        `name` - the file name within the directory to check
      Returns:
        true if this file matches the test

    - #### toString

          public String toString()

      Provide a String representation of this file filter.
      Overrides:
        `toString` in class `Object`
      Returns:
        a String representation

Copyright © 2002–2020 The Apache Software Foundation. All rights reserved.