61 |
* matter, a custom ClassLoader can perform on-the-fly code generation or |
* matter, a custom ClassLoader can perform on-the-fly code generation or |
62 |
* modification! |
* modification! |
63 |
* |
* |
|
* XXX - Not all support has been written for the new 1.2 methods yet! |
|
|
* |
|
64 |
* <p>Every classloader has a parent classloader that is consulted before |
* <p>Every classloader has a parent classloader that is consulted before |
65 |
* the 'child' classloader when classes or resources should be loaded. |
* the 'child' classloader when classes or resources should be loaded. |
66 |
* This is done to make sure that classes can be loaded from an hierarchy of |
* This is done to make sure that classes can be loaded from an hierarchy of |
208 |
*/ |
*/ |
209 |
protected ClassLoader() throws SecurityException |
protected ClassLoader() throws SecurityException |
210 |
{ |
{ |
211 |
this(getSystemClassLoader()); |
this(systemClassLoader); |
212 |
} |
} |
213 |
|
|
214 |
/** |
/** |
256 |
* out if the class has already been loaded through this classloader by |
* out if the class has already been loaded through this classloader by |
257 |
* calling <code>findLoadedClass()</code>. Then it calls |
* calling <code>findLoadedClass()</code>. Then it calls |
258 |
* <code>loadClass()</code> on the parent classloader (or when there is |
* <code>loadClass()</code> on the parent classloader (or when there is |
259 |
* no parent on the bootstrap classloader). When the parent could not load |
* no parent it uses the VM bootclassloader)</code>). If the class is still |
260 |
* the class it tries to create a new class by calling |
* not loaded it tries to create a new class by calling |
261 |
* <code>findClass()</code>. Finally when <code>resolve</code> is |
* <code>findClass()</code>. Finally when <code>resolve</code> is |
262 |
* <code>true</code> it also calls <code>resolveClass()</code> on the |
* <code>true</code> it also calls <code>resolveClass()</code> on the |
263 |
* newly loaded class. |
* newly loaded class. |
395 |
* in that package must have the same set of certificates or a |
* in that package must have the same set of certificates or a |
396 |
* SecurityException is thrown. |
* SecurityException is thrown. |
397 |
* |
* |
|
* XXX - protection domain is not implemented yet; it needs native support. |
|
|
* |
|
398 |
* @param name the name to give the class. null if unknown |
* @param name the name to give the class. null if unknown |
399 |
* @param data the data representing the classfile, in classfile format |
* @param data the data representing the classfile, in classfile format |
400 |
* @param offset the offset into the data where the classfile starts |
* @param offset the offset into the data where the classfile starts |
446 |
protected final Class findSystemClass(String name) |
protected final Class findSystemClass(String name) |
447 |
throws ClassNotFoundException |
throws ClassNotFoundException |
448 |
{ |
{ |
449 |
return Class.forName(name, false, getSystemClassLoader()); |
return Class.forName(name, false, systemClassLoader); |
450 |
} |
} |
451 |
|
|
452 |
/** |
/** |
607 |
*/ |
*/ |
608 |
public static final URL getSystemResource(String name) |
public static final URL getSystemResource(String name) |
609 |
{ |
{ |
610 |
return getSystemClassLoader().getResource(name); |
return systemClassLoader.getResource(name); |
611 |
} |
} |
612 |
|
|
613 |
/** |
/** |
623 |
*/ |
*/ |
624 |
public static Enumeration getSystemResources(String name) throws IOException |
public static Enumeration getSystemResources(String name) throws IOException |
625 |
{ |
{ |
626 |
return getSystemClassLoader().getResources(name); |
return systemClassLoader.getResources(name); |
627 |
} |
} |
628 |
|
|
629 |
/** |
/** |