public class DirFilter
extends java.lang.Object
implements java.io.FilenameFilter
This example creates a DirFilter object to determine which IFSJavaFile objects are directories.
// Create an IFSJavaFile object. IFSJavaFile root = new IFSJavaFile(system, "/QIBM"); // Create a DirFilter object. DirFilter filter = new DirFilter(); // Get the list of directories. File[] dirList = root.listFiles(filter); // Create a tree element with each directory. for (int i=0; i < dirList.length; i++) { FileTreeElement node = new FileTreeElement(dirList[i]); ServletHyperlink sl = new ServletHyperlink(urlParser.getURI()); sl.setHttpServletResponse(resp); node.setIconUrl(sl); tree.addElement(node); }
FileTreeElement
Constructor and Description |
---|
DirFilter()
Constructs a default DirFilter object.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(java.io.File file,
java.lang.String filename)
Determines if a file should be included in a list of directories.
|
public boolean accept(java.io.File file, java.lang.String filename)
accept
in interface java.io.FilenameFilter
file
- The directory in which the file was found.filename
- The name of the file.