com.mindprod.filter
Class ClamFilter

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

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

Select files that begin/end with a given string.

filter out all but files/directories that begin and end with given string, a primitive sort of wildcard feature. Case insensitive. If you just want extensions, the newer ExtensionListFilter is better. see FileListFilter if you just have a list of specific files.

Since:
2003
Version:
2.7 2010-11-22 - add optional invert parameter on a number of the filters.
Author:
Roedy Green, Canadian Mind Products

Constructor Summary
ClamFilter(boolean invert, java.lang.String mustStartWith, java.lang.String mustEndWith)
          constructor
ClamFilter(java.lang.String mustStartWith, java.lang.String mustEndWith)
          constructor
 
Method Summary
 boolean accept(java.io.File dir, java.lang.String name)
          Select only files with with appropriate beginning and end.
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

ClamFilter

public ClamFilter(java.lang.String mustStartWith,
                  java.lang.String mustEndWith)
constructor

Parameters:
mustStartWith - string the filename must start with
mustEndWith - string the filename must end with, usually of form ".html" including the dot.

ClamFilter

public ClamFilter(boolean invert,
                  java.lang.String mustStartWith,
                  java.lang.String mustEndWith)
constructor

Parameters:
invert - if true, selects files not in the range instead.
mustStartWith - string the filename must start with
mustEndWith - string the filename must end with, usually of form ".html" including the dot.
Method Detail

accept

public boolean accept(java.io.File dir,
                      java.lang.String name)
Select only files with with appropriate beginning and end.

Specified by:
accept in interface java.io.FilenameFilter
Parameters:
dir - the directory in which the file was found.
name - the 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 - not used