public class JHelpJarClassLoader
extends java.lang.ClassLoader
Modifier and Type | Field and Description |
---|---|
private java.util.ArrayList<java.util.jar.JarFile> |
arrayList
List of jars
|
private java.lang.ClassLoader |
classLoader
Reference class loader
|
private java.util.Hashtable<java.lang.String,java.lang.Class<?>> |
loadedClass
Already loaded classes
|
Constructor and Description |
---|
JHelpJarClassLoader()
Constructs JHelpClassLoader
|
JHelpJarClassLoader(java.lang.ClassLoader classLoader)
Create a new instance of JHelpJarClassLoader
|
Modifier and Type | Method and Description |
---|---|
void |
add(java.io.File file)
Add a jar file
|
void |
add(java.util.jar.JarFile jarFile)
Add a jar file
|
void |
add(java.lang.String name)
Add a jar file
|
java.net.URL |
getResource(java.lang.String name)
Get URL for a resource
|
java.io.InputStream |
getResourceAsStream(java.lang.String name)
Get stream for read a resource
|
java.util.Enumeration<java.net.URL> |
getResources(java.lang.String name)
Get all resources with same name
|
java.util.HashSet<java.lang.String> |
listOfDirectInternal(java.lang.String name)
List of classes are directly internal to a given one
|
java.lang.Class<?> |
loadClass(java.lang.String name)
Load a class
|
protected java.lang.Class<?> |
loadClass(java.lang.String name,
boolean resolve)
Load a class
|
void |
unloadClass(java.lang.String name)
Un load a class
|
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
private final java.util.ArrayList<java.util.jar.JarFile> arrayList
private final java.lang.ClassLoader classLoader
private final java.util.Hashtable<java.lang.String,java.lang.Class<?>> loadedClass
public JHelpJarClassLoader()
public JHelpJarClassLoader(java.lang.ClassLoader classLoader)
classLoader
- Reference class loaderprotected java.lang.Class<?> loadClass(java.lang.String name, boolean resolve) throws java.lang.ClassNotFoundException
loadClass
in class java.lang.ClassLoader
name
- Class complete nameresolve
- Indicates if have to resolvejava.lang.ClassNotFoundException
- If file not exists in one of jars and can't be retrieve by default class loaderClassLoader.loadClass(java.lang.String, boolean)
public void add(java.io.File file) throws java.io.IOException
file
- Jar file to addjava.io.IOException
- If file is not a jar filepublic void add(java.util.jar.JarFile jarFile)
jarFile
- Jar file to addpublic void add(java.lang.String name) throws java.io.IOException
name
- Jar file pathjava.io.IOException
- If path is not a jar filepublic java.net.URL getResource(java.lang.String name)
getResource
in class java.lang.ClassLoader
name
- Resource complete namenull
if resource not foundClassLoader.getResource(java.lang.String)
public java.io.InputStream getResourceAsStream(java.lang.String name)
getResourceAsStream
in class java.lang.ClassLoader
name
- Resource complete namenull
if resource not foundClassLoader.getResourceAsStream(java.lang.String)
public java.util.Enumeration<java.net.URL> getResources(java.lang.String name) throws java.io.IOException
getResources
in class java.lang.ClassLoader
name
- Resource namejava.io.IOException
- On creating list issusClassLoader.getResources(java.lang.String)
public java.util.HashSet<java.lang.String> listOfDirectInternal(java.lang.String name)
name
- Class base namepublic java.lang.Class<?> loadClass(java.lang.String name) throws java.lang.ClassNotFoundException
loadClass
in class java.lang.ClassLoader
name
- Class complete namejava.lang.ClassNotFoundException
- If class is not foundClassLoader.loadClass(java.lang.String)
public void unloadClass(java.lang.String name)
name
- Class complete name