Logo Search packages:      
Sourcecode: japitools version File versions  Download package

static void net::wuffies::japi::Japize::scanDirForPackage ( String  pathElem,
String  pkg,
SortedSet  classes,
SortedSet  subpkgs 
) throws IOException [inline, static, package]

Process a directory as entered on the command line (ie, a root of the class hierarchy - the same thing that would appear in a Classpath).

Parameters:
pathElem The name of the directory to process.
pkg The package to scan for.
classes A set to add classes found to.
subpkgs A set to add subpackages found to.

Definition at line 468 of file Japize.java.

                                                                   {

    // Replace dot by slash and remove the trailing comma. It's the caller's
    // responsibility to ensure that the last character is a comma.
    pkg = pkg.substring(0, pkg.length() - 1);
    String pkgf = pkg.replace('.', '/');

    // If there is a directory of the appropriate name, recurse over it.
    File dir = new File(pathElem, pkgf);

    // Iterate over the files and directories within this directory.
    String[] entries = dir.list();
    for (int i = 0; i < entries.length; i++) {
      File f2 = new File(dir, entries[i]);

      // If the entry is another directory, add the package associated with
      // it to the set of subpackages.
      // "-" entry for it.
      if (f2.isDirectory()) {
        subpkgs.add(pkg + '.' + entries[i] + ',');

      // If the entry is a file ending with ".class", add the class name to
      // the set of classes.
      } else if (entries[i].endsWith(".class")) {
        classes.add(pkg + ',' +
            entries[i].substring(0, entries[i].length() - 6));
      }
    }
  }


Generated by  Doxygen 1.6.0   Back to index