Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.barteo.emulator.app.util
Class ProgressJarClassLoader  view ProgressJarClassLoader download ProgressJarClassLoader.java

java.lang.Object
  extended byjava.lang.ClassLoader
      extended bycom.barteo.emulator.app.util.ProgressJarClassLoader

public class ProgressJarClassLoader
extends java.lang.ClassLoader


Nested Class Summary
 
Nested classes inherited from class java.lang.ClassLoader
 
Field Summary
(package private)  java.util.Hashtable entries
           
(package private)  ProgressListener listener
           
(package private)  java.util.Vector notLoadedRepositories
           
 
Fields inherited from class java.lang.ClassLoader
 
Constructor Summary
ProgressJarClassLoader()
           
ProgressJarClassLoader(java.lang.ClassLoader parent)
           
 
Method Summary
 void addRepository(java.net.URL url)
           
 java.lang.Class findClass(java.lang.String name)
          Called for every class name that is needed but has not yet been defined by this classloader or one of its parents.
private  void fireProgressListener(ProgressEvent event)
           
 java.io.InputStream getResourceAsStream(java.lang.String name)
          Get a resource as stream using this classloader or one of its parents.
private  byte[] loadClassData(java.lang.String name)
           
private  void loadRepositories()
           
 void setProgressListener(ProgressListener listener)
           
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, getResource, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

entries

java.util.Hashtable entries

notLoadedRepositories

java.util.Vector notLoadedRepositories

listener

ProgressListener listener
Constructor Detail

ProgressJarClassLoader

public ProgressJarClassLoader()

ProgressJarClassLoader

public ProgressJarClassLoader(java.lang.ClassLoader parent)
Method Detail

addRepository

public void addRepository(java.net.URL url)

findClass

public java.lang.Class findClass(java.lang.String name)
                          throws java.lang.ClassNotFoundException
Description copied from class: java.lang.ClassLoader
Called for every class name that is needed but has not yet been defined by this classloader or one of its parents. It is called by loadClass() after both findLoadedClass() and parent.loadClass() couldn't provide the requested class.

The default implementation throws a ClassNotFoundException. Subclasses should override this method. An implementation of this method in a subclass should get the class bytes of the class (if it can find them), if the package of the requested class doesn't exist it should define the package and finally it should call define the actual class. It does not have to resolve the class. It should look something like the following:

 // Get the bytes that describe the requested class
 byte[] classBytes = classLoaderSpecificWayToFindClassBytes(name);
 // Get the package name
 int lastDot = name.lastIndexOf('.');
 if (lastDot != -1)
   {
     String packageName = name.substring(0, lastDot);
     // Look if the package already exists
     if (getPackage(packageName) == null)
       {
         // define the package
         definePackage(packageName, ...);
       }
   }
 // Define and return the class
  return defineClass(name, classBytes, 0, classBytes.length);
 

loadClass() makes sure that the Class returned by findClass() will later be returned by findLoadedClass() when the same class name is requested.


getResourceAsStream

public java.io.InputStream getResourceAsStream(java.lang.String name)
Description copied from class: java.lang.ClassLoader
Get a resource as stream using this classloader or one of its parents. First calls getResource() and if that returns a URL to the resource then it calls and returns the InputStream given by URL.openStream().

Subclasses should not override this method but should override findResource() which is called by this method.


loadClassData

private byte[] loadClassData(java.lang.String name)
                      throws java.lang.ClassNotFoundException

setProgressListener

public void setProgressListener(ProgressListener listener)

fireProgressListener

private void fireProgressListener(ProgressEvent event)

loadRepositories

private void loadRepositories()