Package org.apache.commons.io.filefilter
Class AbstractFileFilter
java.lang.Object
org.apache.commons.io.filefilter.AbstractFileFilter
- All Implemented Interfaces:
FileFilter,FilenameFilter,FileVisitor<Path>,PathMatcher,PathFilter,PathVisitor,IOFileFilter
- Direct Known Subclasses:
AgeFileFilter,AndFileFilter,CanExecuteFileFilter,CanReadFileFilter,CanWriteFileFilter,DelegateFileFilter,DirectoryFileFilter,EmptyFileFilter,FileEqualsFileFilter,FileFileFilter,HiddenFileFilter,MagicNumberFileFilter,NameFileFilter,NotFileFilter,OrFileFilter,PathEqualsFileFilter,PathMatcherFileFilter,PathVisitorFileFilter,PrefixFileFilter,RegexFileFilter,SizeFileFilter,SuffixFileFilter,SymbolicLinkFileFilter,WildcardFileFilter,WildcardFilter
Abstracts the implementation of the
FileFilter (IO), FilenameFilter (IO), PathFilter (NIO)
interfaces via our own IOFileFilter interface.
Note that a subclass MUST override one of the accept methods, otherwise that subclass will infinitely loop.
- Since:
- 1.0
-
Field Summary
Fields inherited from interface org.apache.commons.io.filefilter.IOFileFilter
EMPTY_STRING_ARRAY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks to see if the File should be accepted by this filter.booleanChecks to see if the File should be accepted by this filter.postVisitDirectory(Path dir, IOException exc) preVisitDirectory(Path dir, BasicFileAttributes attributes) toString()Provides a String representation of this file filter.visitFile(Path file, BasicFileAttributes attributes) visitFileFailed(Path file, IOException exc)
-
Constructor Details
-
AbstractFileFilter
public AbstractFileFilter()Constructs a new instance.
-
-
Method Details
-
accept
Checks to see if the File should be accepted by this filter.- Specified by:
acceptin interfaceFileFilter- Specified by:
acceptin interfaceIOFileFilter- Parameters:
file- the File to check- Returns:
- true if this file matches the test
-
accept
Checks to see if the File should be accepted by this filter.- Specified by:
acceptin interfaceFilenameFilter- Specified by:
acceptin interfaceIOFileFilter- Parameters:
dir- the directory File to checkname- the file name within the directory to check- Returns:
- true if this file matches the test
-
postVisitDirectory
- Specified by:
postVisitDirectoryin interfaceFileVisitor<Path>- Throws:
IOException
-
preVisitDirectory
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attributes) throws IOException - Specified by:
preVisitDirectoryin interfaceFileVisitor<Path>- Throws:
IOException
-
toString
Provides a String representation of this file filter. -
visitFile
- Specified by:
visitFilein interfaceFileVisitor<Path>- Throws:
IOException
-
visitFileFailed
- Specified by:
visitFileFailedin interfaceFileVisitor<Path>- Throws:
IOException
-