FileDocCategorySizeDatePackage
FilterExample.javaAPI DocExample2113Wed May 18 09:39:00 BST 2005com.discursive.jccook.io

FilterExample

public class FilterExample extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

		new FilterExample().start();
	
public voidstart()

		File rootDir = new File(".");
		FilenameFilter fileFilter = new SuffixFileFilter(".xml");
		String[] xmlFiles = rootDir.list( fileFilter );
		System.out.println( "*** XML Files" );
		System.out.println( ArrayUtils.toString( xmlFiles ) );		


		rootDir = new File("./test");

		IOFileFilter htmlFilter = new OrFileFilter( new SuffixFileFilter("htm"),
											   new SuffixFileFilter("html") );
		IOFileFilter notDirectory = new NotFileFilter( DirectoryFileFilter.INSTANCE );
		fileFilter = new AndFileFilter( htmlFilter, notDirectory );

		String[] htmlFiles = rootDir.list(fileFilter);
		System.out.println( "*** HTML Files" );
		System.out.println( ArrayUtils.toString( htmlFiles ) );