com.cometway.io
Class WildCardFilenameFilter

java.lang.Object
  extended by com.cometway.io.WildCardFilenameFilter
All Implemented Interfaces:
java.io.FilenameFilter

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

This class is an implementation of java.io.FilenameFilter. This FilenameFilter filters filenames using a wildcard match. Currently, only one wildcard can be used.


Constructor Summary
WildCardFilenameFilter(java.lang.String expression)
          Creates a new WildCardFilenameFilter which filters out filenames that do not match the String expression parameter.
 
Method Summary
 boolean accept(java.io.File dir, java.lang.String name)
          Implements java.io.FilenameFilter.accept(File,String).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WildCardFilenameFilter

public WildCardFilenameFilter(java.lang.String expression)
Creates a new WildCardFilenameFilter which filters out filenames that do not match the String expression parameter. The expression must contain the absolute path. The '*' symbol is used as the wildcard. The wildcard can only appear at the end of the absolute path. For example '/usr/home/java/Test*.java' is valid whereas '/usr/home/java*_dir/Test.class' is not valid. Currently, only one wildcard per expression is supported.

Parameters:
expression - This is the absolute path to wildcard match. If the expression contains no wildcards, an exact match will be made. If the expression is empty, all matches are accepted.
Method Detail

accept

public boolean accept(java.io.File dir,
                      java.lang.String name)
Implements java.io.FilenameFilter.accept(File,String).

Specified by:
accept in interface java.io.FilenameFilter