jodd.file
Class FindFile
java.lang.Object
jodd.file.FindFile
- public class FindFile
- extends java.lang.Object
Generic file finder, browses all files of specified folder. Search starts
with the call to first()
method, that will return founded
file or null
if no file found. Method next()
then retrieves all other founded files, one by one. It will return
null
when search is over. Here is the example:
FindFile ff = new FindFile();
File f = ff.first("class");
while (f != null) {
f = ff.next();
}
This is default behaviour, and it can be changed with following
flags:
- r - search subdirectories (i.e. recursivly)
- d - also include directories in search results
- x - exclude files from search results
A list of FileFilter
implementation can be added to the
search. Each file is matched on every availiable filter, and only if
all filters accept the file, it will be returned.
- See Also:
FileFilter
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FindFile
public FindFile()
setRecursive
public void setRecursive(boolean v)
getRecursive
public boolean getRecursive()
setIncludeDirs
public void setIncludeDirs(boolean v)
getIncludeDirs
public boolean getIncludeDirs()
setExcludeFiles
public void setExcludeFiles(boolean v)
getExcludeFiles
public boolean getExcludeFiles()
setFileFilters
public void setFileFilters(java.util.List ffs)
setFileFilters
public void setFileFilters(java.io.FileFilter[] ff)
setFileFilters
public void setFileFilters(java.io.FileFilter ff)
setFileFilters
public void setFileFilters()
getFileFilters
public java.util.List getFileFilters()
getFileFilter
public java.io.FileFilter getFileFilter()
first
public java.io.File first(java.lang.String dir,
java.lang.String opt,
java.io.FileFilter ff)
first
public java.io.File first(java.lang.String dir,
java.lang.String opt,
java.io.FileFilter[] ffa)
first
public java.io.File first(java.lang.String dir,
java.lang.String opt,
java.util.List ffs)
first
public java.io.File first(java.lang.String dir,
java.lang.String opt)
first
public java.io.File first(java.lang.String dir)
next
public java.io.File next()
- Finds the next file once when search is activated.
- Returns:
- founded file,
null
if no file has been found or if no more files.
Jodd v0.24.5 Javadoc