com.mindprod.filter
Class WildcardFilter

java.lang.Object
  extended by com.mindprod.filter.WildcardFilter
All Implemented Interfaces:
java.io.FilenameFilter

public final class WildcardFilter
extends java.lang.Object
implements java.io.FilenameFilter

filter out all but files that match a given wildcard Pattern.

Note the name is WildcardFilter not WildCardFilter.

Since:
2009-04-08
Version:
2.5 2009-02-28 - CommandLine split off in its own package.
Author:
Roedy Green, Canadian Mind Products

Constructor Summary
WildcardFilter(java.lang.String wildcard)
          constructor
 
Method Summary
 boolean accept(java.io.File dir, java.lang.String name)
          Select only files that match the wildcard/regex Pattern.
static void main(java.lang.String[] args)
          Test Harness
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WildcardFilter

public WildcardFilter(java.lang.String wildcard)
constructor

Parameters:
wildcard - pattern of files you want e.g. some*.txt debug?.c*
Method Detail

accept

public boolean accept(java.io.File dir,
                      java.lang.String name)
Select only files that match the wildcard/regex Pattern.

Specified by:
accept in interface java.io.FilenameFilter
Parameters:
dir - the directory in which the file was found.
name - the simple name of the file
Returns:
true if and only if the name should be included in the file list; false otherwise.

main

public static void main(java.lang.String[] args)
Test Harness

Parameters:
args - wildcar, best enclosed in quotes to prevent other levels tampering with it..