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

void org::osjava::jardiff::JarDiff::loadClasses ( Map  infoMap,
URL  path 
) throws DiffException [inline, private]

Load all the classes from the specified URL and store information about them in the specified map. This currently only works for jar files, not directories which contain classes in subdirectories or in the current directory.

Parameters:
infoMap the map to store the ClassInfo in.
Exceptions:
DiffException if there is an exception reading info about a class.

Definition at line 208 of file JarDiff.java.

Referenced by loadNewClasses(), and loadOldClasses().

                                                                         {
        try {
            File jarFile = null;
            if(!"file".equals(path.getProtocol()) || path.getHost() != null) {
                // If it's not a local file, store it as a temporary jar file.
                // java.util.jar.JarFile requires a local file handle.
                jarFile = File.createTempFile("jardiff","jar");
                // Mark it to be deleted on exit.
                jarFile.deleteOnExit();
                InputStream in = path.openStream();
                OutputStream out = new FileOutputStream(jarFile);
                byte[] buffer = new byte[4096];
                int i;
                while( (i = in.read(buffer,0,buffer.length)) != -1) {
                    out.write(buffer, 0, i);
                }
                in.close();
                out.close();
            } else {
                // Else it's a local file, nothing special to do.
                jarFile = new File(path.getPath());
            }
            loadClasses(infoMap, jarFile);
        } catch (IOException ioe) {
            throw new DiffException(ioe);
        }
    }


Generated by  Doxygen 1.6.0   Back to index