Package jade.core.management
Class JarClassLoader
- java.lang.Object
-
- java.lang.ClassLoader
-
- jade.core.management.JarClassLoader
-
public class JarClassLoader extends ClassLoader
This ClassLoader is intended to be used to load agent classes packed within a jar file. If the specified jar does not exist this ClassLoader will attempt to load classes from the system ClassLoader.- Version:
- 1.2
- Author:
- Jordi Cucurull Juan, Joan Ametller Esquerra
-
-
Field Summary
Fields Modifier and Type Field Description static intBUFFER_SIZE
-
Constructor Summary
Constructors Constructor Description JarClassLoader(File[] ff, ClassLoader parent)JarClassLoader(File f, ClassLoader parent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Method which close the JAR file.protected voidfinalize()Clean up the JarClassLoader.protected ClassfindClass(String className)Get a class from within the JAR file used in this classloader.URLfindResource(String name)Get a resource from within this classloader.StringgetJarFileName()Get the Jar filename.-
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
-
-
-
Field Detail
-
BUFFER_SIZE
public static final int BUFFER_SIZE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JarClassLoader
public JarClassLoader(File f, ClassLoader parent) throws IOException
- Parameters:
Path- and name of the JAR file- Throws:
IOException- If there are problems opening the file
-
JarClassLoader
public JarClassLoader(File[] ff, ClassLoader parent) throws IOException
- Throws:
IOException
-
-
Method Detail
-
close
public void close()
Method which close the JAR file.
-
getJarFileName
public String getJarFileName()
Get the Jar filename.- Returns:
- String - Jar absolute path.
-
findClass
protected Class findClass(String className) throws ClassNotFoundException
Get a class from within the JAR file used in this classloader.- Overrides:
findClassin classClassLoader- Throws:
ClassNotFoundException
-
findResource
public URL findResource(String name)
Get a resource from within this classloader. public InputStream getResourceAsStream(String name) { if (_jarFile != null) { ZipEntry zEntry = _jarFile.getEntry(name); try { if (zEntry != null) { return _jarFile.getInputStream(zEntry); } else return null; } catch (IOException ioe) { return null; } } else { return null; } }- Overrides:
findResourcein classClassLoader
-
-