All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class kmy.util.match.FileMatchingPattern

kmy.util.match.FileMatchingPattern

public class FileMatchingPattern
This class defines a file matching pattern as in UNIX csh command interpreter with some exceptions. The pattern can be represented as string and normally contains some of the special matching constructs:
*
matches any (perhaps empty) sequence of characters
/
matches any single character
[charset]
charset should be a sequence of characters or character ranges (for example a-z represents al lowercase letters). Character ^ appearing in the beginning of charset reverses its meaning.
A pattern may contain arbitrarily nested folders, for example java/n*t/S*.java . The differences between this class and csh file substitution are the following: Normally one just creates FileMatchingPattern using its constructor and then calls method list. If you want to implement {} constructs you have to call static method expand to to pattern preprocessing and then create FileMatchingPattern for every string in the array it returns. You also might want to perform ~user construct substitution in between.


Constructor Index

 o FileMatchingPattern(String)
Constructor allows one to create FileMatchingPattern from a String that is normally used to represent it.

Method Index

 o expand(String)
Expands {} constructs.
 o list(File, Vector)
Produce a list of files that match this pattern.

Constructors

 o FileMatchingPattern
 public FileMatchingPattern(String pattern)
Constructor allows one to create FileMatchingPattern from a String that is normally used to represent it. Note that it works with / as a file separator, not File.separator.

Methods

 o list
 public void list(File dir,
                  Vector flist)
Produce a list of files that match this pattern. Matching files will be added to a vector flist.

Parameters:
dir - first argument is a reference path that is needed only for non-absolute patterns. Absolute patterns may pass null here.
flist - a vector to accumulate matching files
 o expand
 public static String[] expand(String patt)
Expands {} constructs. For example {a,b}c becomes ac bc, or {a{b,c},d}{e,f} becomes abe abf ace acf de df.


All Packages  Class Hierarchy  This Package  Previous  Next  Index