com.etasoft.trans.io
Class axWildcardFileFilter

java.lang.Object
  extended bycom.etasoft.trans.io.axWildcardFileFilter
All Implemented Interfaces:
java.io.FileFilter

public class axWildcardFileFilter
extends java.lang.Object
implements java.io.FileFilter

An instance of FileFilter that filters with the same wildcard patterns that MS-DOS and Windows do. The only supported characters are * (which matches zero or more characters) and ? (which matches one character).

Eg:

Version:
$Revision: 1.2 $
Author:
Jonathan Purvis

Constructor Summary
axWildcardFileFilter(java.lang.String filter)
          Creates a WildcardFileFilter which doesn't allow directories in the accepted files.
axWildcardFileFilter(java.lang.String filter, boolean allow)
          Creates a WildcardFileFilter with optional allowing directories in the accepted files.
 
Method Summary
 boolean accept(java.io.File pathname)
          Tests whether or not the specified abstract pathname should be included in a pathname list.
static boolean wildcardCompare(java.lang.String test, java.lang.String pattern)
          Compares two strings, one containing * and ? wildcard characters, and checks if they match.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

axWildcardFileFilter

public axWildcardFileFilter(java.lang.String filter,
                            boolean allow)
Creates a WildcardFileFilter with optional allowing directories in the accepted files.

Parameters:
filter - The wildcard string to filter on.
allow - Whether to allow directories or not.

axWildcardFileFilter

public axWildcardFileFilter(java.lang.String filter)
Creates a WildcardFileFilter which doesn't allow directories in the accepted files.

Parameters:
filter - The wildcard string to filter on.
Method Detail

accept

public boolean accept(java.io.File pathname)
Tests whether or not the specified abstract pathname should be included in a pathname list.

Specified by:
accept in interface java.io.FileFilter
Parameters:
pathname - The abstract pathname to be tested.
Returns:
true if and only if pathname should be included.

wildcardCompare

public static boolean wildcardCompare(java.lang.String test,
                                      java.lang.String pattern)
Compares two strings, one containing * and ? wildcard characters, and checks if they match.

Parameters:
test - The string to test.
pattern - The string containing wildcards to match on.
Returns:
true if the strings match, false otherwise.