org.apache.commons.io.filefilter
Class FileFilterUtils
java.lang.Object
org.apache.commons.io.filefilter.FileFilterUtils
public class FileFilterUtils
extends java.lang.Object
Useful utilities for working with file filters. It provides access to all
file filter implementations in this package so you don't have to import
every class you use.
$Revision: 1.8 $ $Date: 2004/02/23 04:37:57 $- Henri Yandell
- Stephen Colebourne
- Jeremias Maerki
FileFilterUtils
public FileFilterUtils()
FileFilterUtils is not normally instantiated.
andFileFilter
public static IOFileFilter andFileFilter(IOFileFilter filter1,
IOFileFilter filter2)
Returns a filter that ANDs the two specified filters.
filter1
- the first filterfilter2
- the second filter
- a filter that ANDs the two specified filters
asFileFilter
public static IOFileFilter asFileFilter(FileFilter filter)
Returns an IOFileFilter
that wraps the
FileFilter
instance.
filter
- the filter to be wrapped
- a new filter that implements IOFileFilter
asFileFilter
public static IOFileFilter asFileFilter(FilenameFilter filter)
Returns an IOFileFilter
that wraps the
FilenameFilter
instance.
filter
- the filter to be wrapped
- a new filter that implements IOFileFilter
directoryFileFilter
public static IOFileFilter directoryFileFilter()
Returns a filter that checks if the file is a directory.
falseFileFilter
public static IOFileFilter falseFileFilter()
Returns a filter that always returns false.
makeCVSAware
public static IOFileFilter makeCVSAware(IOFileFilter filter)
Resturns an IOFileFilter that ignores CVS directories. You may optionally
pass in an existing IOFileFilter in which case it is extended to exclude
CVS directories.
filter
- IOFileFilter to modify, null if a new IOFileFilter
should be created
- the requested (combined) filter
nameFileFilter
public static IOFileFilter nameFileFilter(String name)
Returns a filter that returns true if the filename matches the specified text.
notFileFilter
public static IOFileFilter notFileFilter(IOFileFilter filter)
Returns a filter that NOTs the specified filter.
filter
- the filter to invert
- a filter that NOTs the specified filter
orFileFilter
public static IOFileFilter orFileFilter(IOFileFilter filter1,
IOFileFilter filter2)
Returns a filter that ORs the two specified filters.
filter1
- the first filterfilter2
- the second filter
- a filter that ORs the two specified filters
prefixFileFilter
public static IOFileFilter prefixFileFilter(String prefix)
Returns a filter that returns true if the filename starts with the specified text.
prefix
- the filename prefix
suffixFileFilter
public static IOFileFilter suffixFileFilter(String suffix)
Returns a filter that returns true if the filename ends with the specified text.
suffix
- the filename suffix
trueFileFilter
public static IOFileFilter trueFileFilter()
Returns a filter that always returns true.