org.pf.file
Class DefaultFilenameFilter

java.lang.Object
  extended by org.pf.file.DefaultFilenameFilter
All Implemented Interfaces:
java.io.FilenameFilter

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

This filter implements the standard pattern matching on UNIX and Windows platforms. It supports the wildcards '*' and '?'.

Version:
1.0
Author:
Manfred Duchrow

Constructor Summary
DefaultFilenameFilter(java.lang.String pattern)
          Initialize the new instance with the given filename pattern.
DefaultFilenameFilter(java.lang.String pattern, boolean ignoreCase)
          Initialize the new instance with the given filename pattern.
 
Method Summary
 boolean accept(java.io.File dir, java.lang.String name)
          Tests if a specified file should be included in a file list.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultFilenameFilter

public DefaultFilenameFilter(java.lang.String pattern)
Initialize the new instance with the given filename pattern. Case sensitivity is ON by default.

Parameters:
pattern - The pattern for filenames that match. Can include wildcards '*' and '?'

DefaultFilenameFilter

public DefaultFilenameFilter(java.lang.String pattern,
                             boolean ignoreCase)
Initialize the new instance with the given filename pattern.

Parameters:
pattern - The pattern for filenames that match. Can include wildcards '*' and '?'
ignoreCase - false, if match should be done case sensitive, otherwise true.
Method Detail

accept

public boolean accept(java.io.File dir,
                      java.lang.String name)
Tests if a specified file should be included in a file list.

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 i the name should be included in the file list, false otherwise.