org.apache.commons.io.filefilter

Class AndFileFilter

public class AndFileFilter extends AbstractFileFilter implements ConditionalFileFilter, Serializable

A java.io.FileFilter providing conditional AND logic across a list of file filters. This filter returns true if all filters in the list return true. Otherwise, it returns false. Checking of the file filter list stops when the first filter returns false.

Since: Commons IO 1.0

Version: $Revision: 606381 $ $Date: 2007-12-22 02:03:16 +0000 (Sat, 22 Dec 2007) $

Author: Steven Caswell

Field Summary
ListfileFilters
The list of file filters.
Constructor Summary
AndFileFilter()
Constructs a new instance of AndFileFilter.
AndFileFilter(List fileFilters)
Constructs a new instance of AndFileFilter with the specified list of filters.
AndFileFilter(IOFileFilter filter1, IOFileFilter filter2)
Constructs a new file filter that ANDs the result of two other filters.
Method Summary
booleanaccept(File file)
booleanaccept(File file, String name)
voidaddFileFilter(IOFileFilter ioFileFilter)
ListgetFileFilters()
booleanremoveFileFilter(IOFileFilter ioFileFilter)
voidsetFileFilters(List fileFilters)
StringtoString()
Provide a String representaion of this file filter.

Field Detail

fileFilters

private List fileFilters
The list of file filters.

Constructor Detail

AndFileFilter

public AndFileFilter()
Constructs a new instance of AndFileFilter.

Since: Commons IO 1.1

AndFileFilter

public AndFileFilter(List fileFilters)
Constructs a new instance of AndFileFilter with the specified list of filters.

Parameters: fileFilters a List of IOFileFilter instances, copied, null ignored

Since: Commons IO 1.1

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)
{@inheritDoc }

accept

public boolean accept(File file, String name)
{@inheritDoc }

addFileFilter

public void addFileFilter(IOFileFilter ioFileFilter)
{@inheritDoc }

getFileFilters

public List getFileFilters()
{@inheritDoc }

removeFileFilter

public boolean removeFileFilter(IOFileFilter ioFileFilter)
{@inheritDoc }

setFileFilters

public void setFileFilters(List fileFilters)
{@inheritDoc }

toString

public String toString()
Provide a String representaion of this file filter.

Returns: a String representaion

Copyright (c) 2002-2011 Apache Software Foundation