org.apache.commons.io.filefilter

## Class TrueFileFilter

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

- All Implemented Interfaces:
    FileFilter, FilenameFilter, Serializable, PathFilter, IOFileFilter

      public class TrueFileFilter
      extends Object
      implements IOFileFilter, Serializable

  A file filter that always returns true.
  Since:
    1.0
  See Also:
    `FileFilterUtils.trueFileFilter()`, Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static IOFileFilter` | `INSTANCE` Singleton instance of true filter.
    `static IOFileFilter` | `TRUE` Singleton instance of true filter.

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

      `EMPTY_STRING_ARRAY`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `TrueFileFilter()` Restrictive constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `accept(File file)` Returns true.
    `boolean` | `accept(File dir, String name)` Returns true.
    `FileVisitResult` | `accept(Path file, BasicFileAttributes attributes)` Returns true.
    `IOFileFilter` | `and(IOFileFilter fileFilter)` Creates a new "and" filter with this filter.
    `IOFileFilter` | `negate()` Creates a new "not" filter with this filter.
    `IOFileFilter` | `or(IOFileFilter fileFilter)` Creates a new "or" filter with this filter.
    `String` | `toString()`

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

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

- - ### Field Detail

    - #### TRUE

          public static final IOFileFilter TRUE

      Singleton instance of true filter.
      Since:
        1.3

    - #### INSTANCE

          public static final IOFileFilter INSTANCE

      Singleton instance of true filter. Please use the identical TrueFileFilter.TRUE constant. The new name is more JDK 1.5 friendly as it doesn't clash with other values when using static imports.

  - ### Constructor Detail

    - #### TrueFileFilter

          protected TrueFileFilter()

      Restrictive constructor.

  - ### Method Detail

    - #### accept

          public boolean accept(File file)

      Returns true.
      Specified by:
        `accept` in interface `FileFilter`
      Specified by:
        `accept` in interface `IOFileFilter`
      Parameters:
        `file` - the file to check (ignored)
      Returns:
        true

    - #### accept

          public boolean accept(File dir,
                                String name)

      Returns true.
      Specified by:
        `accept` in interface `FilenameFilter`
      Specified by:
        `accept` in interface `IOFileFilter`
      Parameters:
        `dir` - the directory to check (ignored)
        `name` - the file name (ignored)
      Returns:
        true

    - #### accept

          public FileVisitResult accept(Path file,
                                        BasicFileAttributes attributes)

      Returns true.
      Specified by:
        `accept` in interface `PathFilter`
      Specified by:
        `accept` in interface `IOFileFilter`
      Parameters:
        `file` - the file to check (ignored)
        `attributes` - the file's basic attributes (TODO may be null).
      Returns:
        true
      Since:
        2.9.0

    - #### negate

          public IOFileFilter negate()

      Description copied from interface: `IOFileFilter`
      Creates a new "not" filter with this filter.
      Specified by:
        `negate` in interface `IOFileFilter`
      Returns:
        a new filter.

    - #### or

          public IOFileFilter or(IOFileFilter fileFilter)

      Description copied from interface: `IOFileFilter`
      Creates a new "or" filter with this filter.
      Specified by:
        `or` in interface `IOFileFilter`
      Parameters:
        `fileFilter` - the filter to "or".
      Returns:
        a new filter.

    - #### and

          public IOFileFilter and(IOFileFilter fileFilter)

      Description copied from interface: `IOFileFilter`
      Creates a new "and" filter with this filter.
      Specified by:
        `and` in interface `IOFileFilter`
      Parameters:
        `fileFilter` - the filter to "and".
      Returns:
        a new filter.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

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