Java Reference
In-Depth Information
nameRE = Pattern . compile ( sb . toString ());
} catch
catch ( PatternSyntaxException ex ) {
System . err . println ( "Error: RE " + sb . toString () +
" didn't compile: " + ex );
}
}
/** Do the filtering. For now, only filter on name */
public
public boolean
boolean accept ( File dir , String fileName ) {
File f = new
new File ( dir , fileName );
iif ( f . isDirectory ()) {
return
return true
true ;
// allow recursion
}
iif ( nameRE != null
null ) {
return
return nameRE . matcher ( fileName ). matches ();
}
// TODO size handling.
// Catchall
return
return false
false ;
}
public
public String getName () {
return
return name ;
}
}
Exercise for the reader: in the online source directory, you'll find a class called FindNumFil-
ter , which is meant to (someday) allow relational comparison of sizes, modification times,
and the like, as most find services already offer. Make this work from the command line,
and write a GUI frontend to this program.
Search WWH ::




Custom Search