com.borneo.ftp
Class RegExFilter
java.lang.Object
|
+--gnu.regexp.REToken
|
+--gnu.regexp.RE
|
+--com.borneo.ftp.RegExFilter
- All Implemented Interfaces:
- java.io.FilenameFilter, java.io.Serializable
- public class RegExFilter
- extends RE
- implements java.io.FilenameFilter
- See Also:
- Serialized Form
Constructor Summary |
RegExFilter(java.lang.Object pattern)
Constructs a default Filter for filenames only |
RegExFilter(java.lang.Object pattern,
java.util.Date arg)
Constructs a filter from a name pattern and a date. |
RegExFilter(java.lang.Object pattern,
java.lang.String strDte)
Constructs a filter from a name pattern and a date. |
Method Summary |
boolean |
accept(java.io.File f,
java.lang.String fn)
Return true if this file matches the pattern in the RE instantiated
by the client. |
Methods inherited from class gnu.regexp.RE |
getAllMatches, getAllMatches, getAllMatches, getMatch, getMatch, getMatch, getMatch, getMatchEnumeration, getMatchEnumeration, getMatchEnumeration, getMinimumLength, getNumSubs, isMatch, isMatch, isMatch, next, substitute, substitute, substitute, substituteAll, substituteAll, substituteAll, toString, version |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
RegExFilter
public RegExFilter(java.lang.Object pattern)
throws REException
- Constructs a default Filter for filenames only
- Parameters:
pattern
- a Regular Expression according to the rules in package gnu.regex- Throws:
REException
- thrown when the string pattern was not a well formed RE. The gnu.regex includes an applet to test the regular expression strings.
RegExFilter
public RegExFilter(java.lang.Object pattern,
java.lang.String strDte)
throws REException
- Constructs a filter from a name pattern and a date.
- Parameters:
pattern
- the regular expression according to the rules in gnu.regexstrDte
- string representation of the long value used to instantiate a Date- Throws:
REException
- indicates a string that was not a well formed RE
RegExFilter
public RegExFilter(java.lang.Object pattern,
java.util.Date arg)
throws REException
- Constructs a filter from a name pattern and a date.
- Parameters:
pattern
- the regular expression according to the rules in gnu.regexarg
- a Date corresponds to dateStamp used for compares- Throws:
REException
- indicates a string that was not a well formed RE
accept
public boolean accept(java.io.File f,
java.lang.String fn)
- Return true if this file matches the pattern in the RE instantiated
by the client. If "this" had a date passed in to the constructor then cmpdte is active not null
With an active cmpdte, you must also get a File instance from the parms f and fn
and get the lastModified from that file for comparison with cmpdte.
The file will pass the test if it's newer than cmpdte
- Specified by:
accept
in interface java.io.FilenameFilter
- Parameters:
f
- the directory portion of the full pathnamefn
- just the name.typ portion. does not include directory information.- Returns:
- the pattern matched the name portion.
the pattern matched on name and the lastModified asDate was greater than cmpdte instance variable
- See Also:
FileFilter.accept(java.io.File)