com.ibm.as400.util.html
Class DirFilter

java.lang.Object
  extended by com.ibm.as400.util.html.DirFilter
All Implemented Interfaces:
FilenameFilter

public class DirFilter
extends Object
implements FilenameFilter

The DirFilter class determines if a File object is a directory.

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); }

See Also:
FileTreeElement

Constructor Summary
Constructor and Description
DirFilter()
          Constructs a default DirFilter object.
 
Method Summary
Modifier and Type Method and Description
 boolean accept(File file, String filename)
          Determines if a file should be included in a list of directories.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DirFilter

public DirFilter()
Constructs a default DirFilter object.

Method Detail

accept

public boolean accept(File file,
                      String filename)
Determines if a file should be included in a list of directories.

Specified by:
accept in interface FilenameFilter
Parameters:
file - The directory in which the file was found.
filename - The name of the file.
Returns:
true if the file is a directory; false otherwise.