|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.metastatic.rsync.v2.FNMatch
Handles wildcards for filename matching.
I haven't tested this very thoroughly. I blindly replaced all the '/' characters in the code with File.separatorChar. I tried to rework the logic for C-language tests for '\0' correctly.
I would be eager to receive any bug reports at kevinr@gjt.org.
Ported to Java by Kevin Raulerson
JOS CommandLineGroup
Field Summary | |
---|---|
static int |
FNM_CASEFOLD
Compare without regard to case. |
static int |
FNM_FILE_NAME
Preferred GNU name. |
static int |
FNM_LEADING_DIR
Ignore `/...' after a match. |
static boolean |
FNM_MATCH
Value returned by fnmatch() if STRING matches PATTERN. |
static int |
FNM_NOESCAPE
Backslashes don't quote special chars. |
static boolean |
FNM_NOMATCH
Value returned by fnmatch() if STRING does not match PATTERN. |
static int |
FNM_PATHNAME
No wildcard can ever match `/'. |
static int |
FNM_PERIOD
Leading `.' is matched only explicitly. |
Constructor Summary | |
---|---|
FNMatch()
|
Method Summary | |
---|---|
static boolean |
fnmatch(String pattern,
String string,
int flags)
Match STRING against the filename pattern PATTERN, returning FNM_MATCH if it matches, FNM_NOMATCH if not. |
protected static char |
fold(char c,
int flags)
If flags has its FNM_CASEFOLD bit set, then returns the lowercase of c; otherwise returns c. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int FNM_PATHNAME
public static final int FNM_NOESCAPE
public static final int FNM_PERIOD
public static final int FNM_FILE_NAME
public static final int FNM_LEADING_DIR
public static final int FNM_CASEFOLD
public static final boolean FNM_NOMATCH
public static final boolean FNM_MATCH
Constructor Detail |
public FNMatch()
Method Detail |
public static boolean fnmatch(String pattern, String string, int flags)
pattern
- A string with a wildcard
(* . ? [ ], etc.; \ is the escape).string
- The string to check for wildcards.flags
- Behavior modifiers.
protected static char fold(char c, int flags)
c
- A character to fold.flags
- Bits, set or not, to modify behavior.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |