public class CompositeFileFilter
extends java.lang.Object
implements java.io.FileFilter
FileFilter
that contains other filters.
It is designed for use with either the FsConsumer or FtpConsumer, as a result of the limitations of
ConsumeDestination
, this filter creates its underlying filters from a single __@@__
separated string (this notation was chosen so that it is unlikely to be used as a pattern matching sequence).
The format of the string required is 'FILTER_TYPE'='filter-expression'
where the following types of filter are understood
(case matters).
NewerThan
OlderThan
SizeGreaterThan
SizeGreaterThanSizeGreaterThanOrEqual
SizeLessThan
SizeLessThanOrEqual
org.apache.commons.io.filefilter.RegexFileFilter
- since 3.7.0In the event of a unknown filter type being used, it will be assumed to be a fully qualified classname which will be constructed using reflection; the filter-expression will be passed in as the sole constructor argument.
The filter-expression value is something that is understood by the filter in question. e.g. the size in bytes for Size based filters, any errors encountered attempting to create filter results in the filter being ignored.
The filter only accepts the file if all the underlying filters accept the file, thus this represents an implicit AND condition.
So for example we would use SizeGT=4096__@@__Perl=.*\.xml
to match all files ending with .xml
whose
size is greater than 4096 bytes
Constructor and Description |
---|
CompositeFileFilter(java.lang.String filterExpression)
Create the filefilter using the specified filterExpression.
|
CompositeFileFilter(java.lang.String filterExpression,
boolean quiet) |
Modifier and Type | Method and Description |
---|---|
boolean |
accept(java.io.File pathname) |
public CompositeFileFilter(java.lang.String filterExpression)
filterExpression
- the filter expression.public CompositeFileFilter(java.lang.String filterExpression, boolean quiet)