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:
FileFilter, 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.8 $ $Date: 2004/02/23 04:37:57 $
Author:
Stephen Colebourne

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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

accept

public boolean accept(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(File file,
                      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


Copyright © 2002-2004 The Apache Software Foundation. All Rights Reserved.