org.apache.avalon.excalibur.io
Class PrefixFileFilter

java.lang.Object
  extended byorg.apache.avalon.excalibur.io.PrefixFileFilter
All Implemented Interfaces:
java.io.FilenameFilter

public class PrefixFileFilter
extends java.lang.Object
implements java.io.FilenameFilter

This filters filenames for a certain prefix.

Eg., to print all files and directories in the current directory whose name starts with

foo:
 File dir = new File(".");
 String[] files = dir.list( new PrefixFileFilter("foo"));
 for ( int i=0; i<files.length; i++ )
 {
     System.out.println(files[i]);
 }
 

Since:
4.0
Version:
CVS $Revision: 1.6 $ $Date: 2002/03/16 00:04:01 $
Author:
Federico Barbieri , Serge Knystautas , Peter Donald

Field Summary
private  java.lang.String[] m_prefixs
           
 
Constructor Summary
PrefixFileFilter(java.lang.String prefix)
           
PrefixFileFilter(java.lang.String[] prefixs)
           
 
Method Summary
 boolean accept(java.io.File file, java.lang.String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_prefixs

private java.lang.String[] m_prefixs
Constructor Detail

PrefixFileFilter

public PrefixFileFilter(java.lang.String[] prefixs)

PrefixFileFilter

public PrefixFileFilter(java.lang.String prefix)
Method Detail

accept

public boolean accept(java.io.File file,
                      java.lang.String name)
Specified by:
accept in interface java.io.FilenameFilter