Eg., to print all files beginning with A
and ending with .java
:
File dir = new File("."); String[] files = dir.list( new AndFileFilter( new PrefixFileFilter("A"), new ExtensionFileFilter(".java") ) ); for ( int i=0; i<files.length; i++ ) { System.out.println(files[i]); }@author Harmeet Bedi
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: 232900 $ $Date: 2005-08-15 23:22:30 +0100 (Mon, 15 Aug 2005) $
@author Steven Caswell
Eg., to print all files beginning with A
and ending with .java
:
File dir = new File("."); String[] files = dir.list( new AndFileFilter( new PrefixFileFilter("A"), new ExtensionFileFilter(".java") ) ); for ( int i=0; i<files.length; i++ ) { System.out.println(files[i]); }@author Avalon Development Team @version $Revision: 494012 $ $Date: 2007-01-08 10:23:58 +0000 (Mon, 08 Jan 2007) $ @since 4.0
An AndFileFilter contains logically ANDs other java.io.FileFilter objects. When its {@link #accept accept()}method is called, the AndFileFilter object passes the file through the contained filters. The file is only accepted if it is accepted by all contained filters. This class conceptually provides a logical "AND" operator for file filters.
The contained filters are applied in the order they were added to the AndFileFilter object. This class's {@link #accept accept()}method stops looping over the contained filters as soon as it encounters one whose accept() method returns false (implementing a "short-circuited AND" operation.)
@see FileFilter @see OrFileFilter @see NotFileFilter @see AndFilenameFilter @see RegexFileFilter @version $Revision: 5812 $ @author Copyright © 2004-2007 Brian M. Clapper
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|