SourceForge.net Logo
Version: 0.27 - Last update: 2004-05-30 Home Page - SourceForge Project Page - Contact

Jodd
  Overview
  News
  Download
  License
  References

Development
  Using Jodd
  Javadoc
  JUnit report

Community
  Contribute
  Report a bug

More reading
  Milestone 0.30



Top 25%

BSD
 

FindFile

FindFile is a generic file finder, that browses all files of specified folder. Usage is quite simple:

FindFile example
 
FindFile ff = new FindFile();
File f = ff.first("folder");
while (f != null) {
	...				// do something with file
	f = ff.next();
}

FindFile also knows how to browse all subdirectories, and can return just files, just directories, or both.

More power FindFile can provide by using FileFilters. They can filter out the file list automatically. One such filter is implemented in Jodd: it is RegExpFileFilter. It is quite powerful, since it lets users to specifies regular expressions for matching files. It can be additionally configured not to match path parth of the file or not to match directories.

Here is a quick overview how filters can be used with FindFile:

FindFile with FileFilter example
 
// find all *class files, recursivly, including matched directories in the result
File f = ff.first("class", "rd", new RegExpFileFilter(".*class"));

// find all *s* directories, recursivly, not including files
File f = ff.first("class", "rdx", new RegExpFileFilter(".*s.*", "p"));



http://jodd.sourceforge.net
najgor at users.sourceforge.net