com.ibm.as400.util.html

Class DirFilter

  • java.lang.Object
    • com.ibm.as400.util.html.DirFilter
  • All Implemented Interfaces:
    java.io.FilenameFilter


    public class DirFilter
    extends java.lang.Object
    implements java.io.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

      Constructors 
      Constructor and Description
      DirFilter()
      Constructs a default DirFilter object.
    • Method Summary

      Methods 
      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.
      • 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(java.io.File file,
                     java.lang.String filename)
        Determines if a file should be included in a list of directories.
        Specified by:
        accept in interface java.io.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.