util
Class FileTree.NameFilter

java.lang.Object
  extended by util.FileTree.NameFilter
All Implemented Interfaces:
FileFilter
Enclosing class:
FileTree

public static class FileTree.NameFilter
extends Object
implements FileFilter

A file filter that accepts file names and extensions. Patterns supported ------------------------------ any zero or more characters ? any one character c character c


Field Summary
private  boolean dodirs
          If true, we accept dirs even if name does not match.
private  String name
          The name pattern consists of '*', '?', and regular chars.
 
Constructor Summary
FileTree.NameFilter(String n)
          Construct a new file name filter, specifiying patterns for the file name and the extension.
FileTree.NameFilter(String n, boolean dirs)
          Construct a new file name filter, specifiying patterns for the file name and the extension.
 
Method Summary
 boolean accept(File c)
          Takes the file name and the file extension and matches it against the patterns.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

private String name
The name pattern consists of '*', '?', and regular chars.


dodirs

private boolean dodirs
If true, we accept dirs even if name does not match.

Constructor Detail

FileTree.NameFilter

public FileTree.NameFilter(String n)
Construct a new file name filter, specifiying patterns for the file name and the extension. Paths are not considered for matching. Any null pattern matches anything, same behaviour as a '*' pattern. Per default, dirs are always included.


FileTree.NameFilter

public FileTree.NameFilter(String n,
                           boolean dirs)
Construct a new file name filter, specifiying patterns for the file name and the extension. Paths are not considered for matching. Any null pattern matches anything, same behaviour as a '*' pattern.

Method Detail

accept

public boolean accept(File c)
Takes the file name and the file extension and matches it against the patterns. Does not consider directory paths. Returns true if, the pattern can be wildcard expanded to give the text in the second argument. Based on Wildcard.java.

Specified by:
accept in interface FileFilter