org.apache.commons.io.filefilter

Class AndFileFilter

Implemented Interfaces:
FileFilter, FilenameFilter, IOFileFilter

public class AndFileFilter
extends AbstractFileFilter

This filter produces a logical AND of the two filters specified.
Version:
$Revision: 1.8 $ $Date: 2004/02/23 04:37:57 $
Author:
Stephen Colebourne
Since:
Commons IO 1.0

Field Summary

private IOFileFilter
filter1
The first filter
private IOFileFilter
filter2
The second filter

Constructor Summary

AndFileFilter(IOFileFilter filter1, IOFileFilter filter2)
Constructs a new file filter that ANDs the result of two other filters.

Method Summary

boolean
accept(File file)
Checks to see if both filters are true.
boolean
accept(File file, String name)
Checks to see if both filters are true.

Methods inherited from class org.apache.commons.io.filefilter.AbstractFileFilter

accept, accept

Field Details

filter1

private IOFileFilter filter1
The first filter

filter2

private IOFileFilter filter2
The second filter

Constructor Details

AndFileFilter

public AndFileFilter(IOFileFilter filter1,
                     IOFileFilter filter2)
Constructs a new file filter that ANDs the result of two other filters.
Parameters:
filter1 - the first filter, must not be null
filter2 - the second filter, must not be null

Method Details

accept

public boolean accept(File file)
Checks to see if both filters are true.
Specified by:
accept in interface IOFileFilter
Overrides:
accept in interface AbstractFileFilter
Parameters:
file - the File to check
Returns:
true if both filters are true

accept

public boolean accept(File file,
                      String name)
Checks to see if both filters are true.
Specified by:
accept in interface IOFileFilter
Overrides:
accept in interface AbstractFileFilter
Parameters:
file - the File directory
name - the filename
Returns:
true if both filters are true