Package org.apache.commons.io.filefilter
Class DelegateFileFilter
- java.lang.Object
-
- org.apache.commons.io.filefilter.AbstractFileFilter
-
- org.apache.commons.io.filefilter.DelegateFileFilter
-
- All Implemented Interfaces:
FileFilter,FilenameFilter,Serializable,FileVisitor<Path>,PathFilter,PathVisitor,IOFileFilter
public class DelegateFileFilter extends AbstractFileFilter implements Serializable
This class turns a Java FileFilter or FilenameFilter into an IO FileFilter.- Since:
- 1.0
- See Also:
FileFilterUtils.asFileFilter(FileFilter),FileFilterUtils.asFileFilter(FilenameFilter), Serialized Form
-
-
Field Summary
-
Fields inherited from interface org.apache.commons.io.filefilter.IOFileFilter
EMPTY_STRING_ARRAY
-
-
Constructor Summary
Constructors Constructor Description DelegateFileFilter(FileFilter filter)Constructs a delegate file filter around an existing FileFilter.DelegateFileFilter(FilenameFilter filter)Constructs a delegate file filter around an existing FilenameFilter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaccept(File file)Checks the filter.booleanaccept(File dir, String name)Checks the filter.StringtoString()Provide a String representation of this file filter.-
Methods inherited from class org.apache.commons.io.filefilter.AbstractFileFilter
postVisitDirectory, preVisitDirectory, visitFile, visitFileFailed
-
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
-
-
-
-
Constructor Detail
-
DelegateFileFilter
public DelegateFileFilter(FileFilter filter)
Constructs a delegate file filter around an existing FileFilter.- Parameters:
filter- the filter to decorate
-
DelegateFileFilter
public DelegateFileFilter(FilenameFilter filter)
Constructs a delegate file filter around an existing FilenameFilter.- Parameters:
filter- the filter to decorate
-
-
Method Detail
-
accept
public boolean accept(File file)
Checks the filter.- Specified by:
acceptin interfaceFileFilter- Specified by:
acceptin interfaceIOFileFilter- Overrides:
acceptin classAbstractFileFilter- Parameters:
file- the file to check- Returns:
- true if the filter matches
-
accept
public boolean accept(File dir, String name)
Checks the filter.- Specified by:
acceptin interfaceFilenameFilter- Specified by:
acceptin interfaceIOFileFilter- Overrides:
acceptin classAbstractFileFilter- Parameters:
dir- the directoryname- the file name in the directory- Returns:
- true if the filter matches
-
toString
public String toString()
Provide a String representation of this file filter.- Overrides:
toStringin classAbstractFileFilter- Returns:
- a String representation
-
-