Class FileEqualsFileFilter

  • All Implemented Interfaces:
    java.io.FileFilter, java.io.FilenameFilter, java.nio.file.FileVisitor<java.nio.file.Path>, PathFilter, PathVisitor, IOFileFilter

    public class FileEqualsFileFilter
    extends AbstractFileFilter
    Accepts only an exact File object match. You can use this filter to visit the start directory when walking a file tree with Files.walkFileTree(java.nio.file.Path, java.util.Set, int, java.nio.file.FileVisitor).
    Since:
    2.9.0
    • Constructor Detail

      • FileEqualsFileFilter

        public FileEqualsFileFilter​(java.io.File file)
        Constructs a new instance for the given File.
        Parameters:
        file - The file to match.
    • Method Detail

      • accept

        public boolean accept​(java.io.File file)
        Description copied from class: AbstractFileFilter
        Checks to see if the File should be accepted by this filter.
        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 this file matches the test
      • accept

        public java.nio.file.FileVisitResult accept​(java.nio.file.Path path,
                                                    java.nio.file.attribute.BasicFileAttributes attributes)
        Description copied from interface: IOFileFilter
        Checks to see if the Path should be accepted by this filter.
        Parameters:
        path - the Path to check.
        attributes - the file's basic attributes (TODO may be null).
        Returns:
        true if this path matches the test.