Package org.apache.commons.io.filefilter
Class AbstractFileFilter
- java.lang.Object
-
- org.apache.commons.io.filefilter.AbstractFileFilter
-
- All Implemented Interfaces:
java.io.FileFilter,java.io.FilenameFilter,java.nio.file.FileVisitor<java.nio.file.Path>,PathFilter,PathVisitor,IOFileFilter
- Direct Known Subclasses:
AgeFileFilter,AndFileFilter,CanExecuteFileFilter,CanReadFileFilter,CanWriteFileFilter,DelegateFileFilter,DirectoryFileFilter,EmptyFileFilter,FileEqualsFileFilter,FileFileFilter,HiddenFileFilter,MagicNumberFileFilter,NameFileFilter,NotFileFilter,OrFileFilter,PathEqualsFileFilter,PathVisitorFileFilter,PrefixFileFilter,RegexFileFilter,SizeFileFilter,SuffixFileFilter,SymbolicLinkFileFilter,WildcardFileFilter,WildcardFilter
public abstract class AbstractFileFilter extends java.lang.Object implements IOFileFilter, PathVisitor
Abstracts the implementation of theFileFilter(IO),FilenameFilter(IO),PathFilter(NIO) interfaces via our ownIOFileFilterinterface.Note that a subclass MUST override one of the
acceptmethods, 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 Constructor Description AbstractFileFilter()Constructs a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaccept(java.io.File file)Checks to see if the File should be accepted by this filter.booleanaccept(java.io.File dir, java.lang.String name)Checks to see if the File should be accepted by this filter.java.nio.file.FileVisitResultpostVisitDirectory(java.nio.file.Path dir, java.io.IOException exc)java.nio.file.FileVisitResultpreVisitDirectory(java.nio.file.Path dir, java.nio.file.attribute.BasicFileAttributes attributes)java.lang.StringtoString()Provides a String representation of this file filter.java.nio.file.FileVisitResultvisitFile(java.nio.file.Path file, java.nio.file.attribute.BasicFileAttributes attributes)java.nio.file.FileVisitResultvisitFileFailed(java.nio.file.Path file, java.io.IOException exc)-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.commons.io.filefilter.IOFileFilter
accept, and, negate, or
-
-
-
-
Method Detail
-
accept
public boolean accept(java.io.File file)
Checks to see if the File should be accepted by this filter.- Specified by:
acceptin interfacejava.io.FileFilter- Specified by:
acceptin interfaceIOFileFilter- Parameters:
file- the File to check- Returns:
- true if this file matches the test
-
accept
public boolean accept(java.io.File dir, java.lang.String name)Checks to see if the File should be accepted by this filter.- Specified by:
acceptin interfacejava.io.FilenameFilter- 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
public java.nio.file.FileVisitResult postVisitDirectory(java.nio.file.Path dir, java.io.IOException exc) throws java.io.IOException- Specified by:
postVisitDirectoryin interfacejava.nio.file.FileVisitor<java.nio.file.Path>- Throws:
java.io.IOException
-
preVisitDirectory
public java.nio.file.FileVisitResult preVisitDirectory(java.nio.file.Path dir, java.nio.file.attribute.BasicFileAttributes attributes) throws java.io.IOException- Specified by:
preVisitDirectoryin interfacejava.nio.file.FileVisitor<java.nio.file.Path>- Throws:
java.io.IOException
-
toString
public java.lang.String toString()
Provides a String representation of this file filter.- Overrides:
toStringin classjava.lang.Object- Returns:
- a String representation
-
visitFile
public java.nio.file.FileVisitResult visitFile(java.nio.file.Path file, java.nio.file.attribute.BasicFileAttributes attributes) throws java.io.IOException- Specified by:
visitFilein interfacejava.nio.file.FileVisitor<java.nio.file.Path>- Throws:
java.io.IOException
-
visitFileFailed
public java.nio.file.FileVisitResult visitFileFailed(java.nio.file.Path file, java.io.IOException exc) throws java.io.IOException- Specified by:
visitFileFailedin interfacejava.nio.file.FileVisitor<java.nio.file.Path>- Throws:
java.io.IOException
-
-