|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--org.jutil.io.fileset.FileNamePattern
A class of filename patterns.
A pattern consists of a sequence of primitive patterns separated by File.separator.
E.g. on unix platforms:
primitive_pattern/primitive_pattern/primitive_patternA primitive pattern consists of characters that may appear in a filename or directory name
(it may not contain File.separator, which isn't allowed on any platform anyway).
The * character has a special meaning. A single * matches any number of characters in a
primitive_pattern. A double * matches any pattern. Some examples will make this clear.
document.tex : matches a file named "document.tex" in the base directory.do*tex : matches all file of which the name starts
with "do" and ends with "tex".Documents/* : matches all files which directly reside in the "Documents" directory, which
is a direct subdirectory of the base directory.../Documents/* : matches all files which directly
reside in the "Documents" directory, which is a direct subdirectory of parent directory of
the base directory.Documents/Presentation*/* : matches all files directly in a directory with a name
starting with "Presentation", which resides directly in "Documents". The "Documents" directory again is
a direct subdirectory of the base directory.
**/* : matches all files in all directories
(recursively) in the base directoryDocuments/**/* : matches all files in all
subdirectories (recursively) in the "Documents" directory.Documents/**/papers/**/*.pdf :
matches all files with "pdf" as extension which resides in a directory which is a subdirectory of
"Documents" and has a directory "papers" in its path relative to "Documents".Documents/**/Presentation*/**/*.pdf
: matches the same as the previous pattern, but now with a directory in the path relative to "Documents"
which begins with "Presentation".
| Constructor Summary | |
FileNamePattern(java.lang.String pattern)
Initialize a new FileNamePattern with the given pattern. |
|
| Method Summary | |
java.lang.String |
getPattern()
Return the pattern of this PatternPredicate. |
java.lang.String |
getRegexPattern()
Return the regex pattern of this PatternPredicate. |
java.lang.String |
getRegexSeparator()
Return a String that represents a file separator in a regular expression. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public FileNamePattern(java.lang.String pattern)
pattern - The pattern for the new PatternPredicate.| Method Detail |
public java.lang.String getPattern()
public java.lang.String getRegexPattern()
public java.lang.String getRegexSeparator()
Return a String that represents a file separator in a regular expression. This method is required because \ is used as escape character.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||