org.apache.commons.io.filefilter
Class AndFileFilter

java.lang.Object
  extended byorg.apache.commons.io.filefilter.AbstractFileFilter
      extended byorg.apache.commons.io.filefilter.AndFileFilter
All Implemented Interfaces:
java.io.FileFilter, java.io.FilenameFilter, IOFileFilter

public class AndFileFilter
extends AbstractFileFilter

This filter produces a logical AND of the two filters specified.

Since:
Commons IO 1.0
Version:
$Revision: 1.7 $ $Date: 2003/12/30 06:55:58 $
Author:
Stephen Colebourne

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(java.io.File file)
          Checks to see if both filters are true.
 boolean accept(java.io.File file, java.lang.String name)
          Checks to see if both filters are true.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

filter1

private IOFileFilter filter1
The first filter


filter2

private IOFileFilter filter2
The second filter

Constructor Detail

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
Throws:
java.lang.IllegalArgumentException - if either filter is null
Method Detail

accept

public boolean accept(java.io.File file)
Checks to see if both filters are true.

Specified by:
accept in interface IOFileFilter
Overrides:
accept in class AbstractFileFilter
Parameters:
file - the File to check
Returns:
true if both filters are true

accept

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

Specified by:
accept in interface IOFileFilter
Overrides:
accept in class AbstractFileFilter
Parameters:
file - the File directory
name - the filename
Returns:
true if both filters are true