|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.io.filefilter.FileFilterUtils
public class FileFilterUtils
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.
Constructor Summary | |
---|---|
FileFilterUtils()
FileFilterUtils is not normally instantiated. |
Method Summary | |
---|---|
static IOFileFilter |
ageFileFilter(Date cutoffDate)
Returns a filter that returns true if the file was last modified after the specified cutoff date. |
static IOFileFilter |
ageFileFilter(Date cutoffDate,
boolean acceptOlder)
Returns a filter that filters files based on a cutoff date. |
static IOFileFilter |
ageFileFilter(File cutoffReference)
Returns a filter that returns true if the file was last modified after the specified reference file. |
static IOFileFilter |
ageFileFilter(File cutoffReference,
boolean acceptOlder)
Returns a filter that filters files based on a cutoff reference file. |
static IOFileFilter |
ageFileFilter(long cutoff)
Returns a filter that returns true if the file was last modified after the specified cutoff time. |
static IOFileFilter |
ageFileFilter(long cutoff,
boolean acceptOlder)
Returns a filter that filters files based on a cutoff time. |
static IOFileFilter |
andFileFilter(IOFileFilter filter1,
IOFileFilter filter2)
Returns a filter that ANDs the two specified filters. |
static IOFileFilter |
asFileFilter(FileFilter filter)
Returns an IOFileFilter that wraps the
FileFilter instance. |
static IOFileFilter |
asFileFilter(FilenameFilter filter)
Returns an IOFileFilter that wraps the
FilenameFilter instance. |
static IOFileFilter |
directoryFileFilter()
Returns a filter that checks if the file is a directory. |
static IOFileFilter |
falseFileFilter()
Returns a filter that always returns false. |
static IOFileFilter |
fileFileFilter()
Returns a filter that checks if the file is a file (and not a directory). |
static IOFileFilter |
makeCVSAware(IOFileFilter filter)
Decorates a filter to make it ignore CVS directories. |
static IOFileFilter |
makeDirectoryOnly(IOFileFilter filter)
Decorates a filter so that it only applies to directories and not to files. |
static IOFileFilter |
makeFileOnly(IOFileFilter filter)
Decorates a filter so that it only applies to files and not to directories. |
static IOFileFilter |
makeSVNAware(IOFileFilter filter)
Decorates a filter to make it ignore SVN directories. |
static IOFileFilter |
nameFileFilter(String name)
Returns a filter that returns true if the filename matches the specified text. |
static IOFileFilter |
notFileFilter(IOFileFilter filter)
Returns a filter that NOTs the specified filter. |
static IOFileFilter |
orFileFilter(IOFileFilter filter1,
IOFileFilter filter2)
Returns a filter that ORs the two specified filters. |
static IOFileFilter |
prefixFileFilter(String prefix)
Returns a filter that returns true if the filename starts with the specified text. |
static IOFileFilter |
sizeFileFilter(long threshold)
Returns a filter that returns true if the file is bigger than a certain size. |
static IOFileFilter |
sizeFileFilter(long threshold,
boolean acceptLarger)
Returns a filter that filters based on file size. |
static IOFileFilter |
sizeRangeFileFilter(long minSizeInclusive,
long maxSizeInclusive)
Returns a filter that accepts files whose size is >= minimum size and <= maximum size. |
static IOFileFilter |
suffixFileFilter(String suffix)
Returns a filter that returns true if the filename ends with the specified text. |
static IOFileFilter |
trueFileFilter()
Returns a filter that always returns true. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileFilterUtils()
Method Detail |
---|
public static IOFileFilter prefixFileFilter(String prefix)
prefix
- the filename prefix
public static IOFileFilter suffixFileFilter(String suffix)
suffix
- the filename suffix
public static IOFileFilter nameFileFilter(String name)
name
- the filename
public static IOFileFilter directoryFileFilter()
public static IOFileFilter fileFileFilter()
public static IOFileFilter andFileFilter(IOFileFilter filter1, IOFileFilter filter2)
filter1
- the first filterfilter2
- the second filter
public static IOFileFilter orFileFilter(IOFileFilter filter1, IOFileFilter filter2)
filter1
- the first filterfilter2
- the second filter
public static IOFileFilter notFileFilter(IOFileFilter filter)
filter
- the filter to invert
public static IOFileFilter trueFileFilter()
public static IOFileFilter falseFileFilter()
public static IOFileFilter asFileFilter(FileFilter filter)
IOFileFilter
that wraps the
FileFilter
instance.
filter
- the filter to be wrapped
public static IOFileFilter asFileFilter(FilenameFilter filter)
IOFileFilter
that wraps the
FilenameFilter
instance.
filter
- the filter to be wrapped
public static IOFileFilter ageFileFilter(long cutoff)
cutoff
- the time threshold
public static IOFileFilter ageFileFilter(long cutoff, boolean acceptOlder)
cutoff
- the time thresholdacceptOlder
- if true, older files get accepted, if false, newer
public static IOFileFilter ageFileFilter(Date cutoffDate)
cutoffDate
- the time threshold
public static IOFileFilter ageFileFilter(Date cutoffDate, boolean acceptOlder)
cutoffDate
- the time thresholdacceptOlder
- if true, older files get accepted, if false, newer
public static IOFileFilter ageFileFilter(File cutoffReference)
cutoffReference
- the file whose last modification
time is usesd as the threshold age of the files
public static IOFileFilter ageFileFilter(File cutoffReference, boolean acceptOlder)
cutoffReference
- the file whose last modification
time is usesd as the threshold age of the filesacceptOlder
- if true, older files get accepted, if false, newer
public static IOFileFilter sizeFileFilter(long threshold)
threshold
- the file size threshold
public static IOFileFilter sizeFileFilter(long threshold, boolean acceptLarger)
threshold
- the file size thresholdacceptLarger
- if true, larger files get accepted, if false, smaller
public static IOFileFilter sizeRangeFileFilter(long minSizeInclusive, long maxSizeInclusive)
minSizeInclusive
- the minimum file size (inclusive)maxSizeInclusive
- the maximum file size (inclusive)
public static IOFileFilter makeCVSAware(IOFileFilter filter)
null
will return a filter that accepts everything
except CVS directories.
filter
- the filter to decorate, null means an unrestricted filter
public static IOFileFilter makeSVNAware(IOFileFilter filter)
null
will return a filter that accepts everything
except SVN directories.
filter
- the filter to decorate, null means an unrestricted filter
public static IOFileFilter makeDirectoryOnly(IOFileFilter filter)
filter
- the filter to decorate, null means an unrestricted filter
public static IOFileFilter makeFileOnly(IOFileFilter filter)
filter
- the filter to decorate, null means an unrestricted filter
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |