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

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

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

pathElem The name of the zipfile 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 508 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('.', '/') + '/';

    // Iterate over all the entries in the zipfile.
    ZipFile z = new ZipFile(pathElem);
    Enumeration ents = z.entries();
    while (ents.hasMoreElements()) {
      String ze = ((ZipEntry)ents.nextElement()).getName();
      // If the entry is a class file and located in the package we are looking
      // for, process it.
      if (ze.startsWith(pkgf) && ze.endsWith(".class")) {

        // Trim off the package bit that we already know and the .class suffix.
        ze = ze.substring(pkgf.length(), ze.length() - 6);

        // If it's directly in the package we're processing, add it to classes.
        // If it's in a subpackage, add the top-level subpackage to subpkgs.
        if (ze.indexOf('/') >= 0) {
          subpkgs.add(pkg + '.' + ze.substring(0, ze.indexOf('/')) + ',');
        } else {
          classes.add(pkg + ',' + ze);

Generated by  Doxygen 1.6.0   Back to index