public class AppClassLoader
extends java.net.URLClassLoader
ExtendLoader.loadJar(File)
,
ExtendLoader.unloadJar(File)
构造器和说明 |
---|
AppClassLoader() |
AppClassLoader(java.lang.ClassLoader parent) |
AppClassLoader(java.net.URL[] urls,
java.lang.ClassLoader parent) |
限定符和类型 | 方法和说明 |
---|---|
void |
addJar(java.io.File file)
添加jar包
|
void |
addJar(java.net.URL url)
添加jar包
|
void |
addJar(java.net.URL url,
boolean useCaches)
添加jar包
|
static void |
bindingThread()
绑定到当前线程
|
void |
close() |
java.net.URL |
getResource(java.lang.String name) |
java.util.Enumeration<java.net.URL> |
getResources(java.lang.String name) |
static AppClassLoader |
global() |
static void |
globalSet(AppClassLoader instance)
设置全局实例
|
java.lang.Class<?> |
loadClass(java.lang.String clzName)
加载类
|
static AppClassLoader |
loadJar(java.io.File fileOrDir)
加载 jar 文件或目录
|
static AppClassLoader |
loadJar(java.net.URL url)
加载 jar 文件
|
void |
removeJar(java.io.File file) |
void |
removeJar(java.net.URL url)
移除jar包
|
addURL, definePackage, findClass, findResource, findResources, getPermissions, getResourceAsStream, getURLs, newInstance, newInstance
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
public AppClassLoader()
public AppClassLoader(java.lang.ClassLoader parent)
parent
- 父加载器public AppClassLoader(java.net.URL[] urls, java.lang.ClassLoader parent)
urls
- 资源组parent
- 父加载器public static AppClassLoader global()
public static void globalSet(AppClassLoader instance)
instance
- 全局实例public static AppClassLoader loadJar(java.net.URL url)
url
- jar urlpublic static AppClassLoader loadJar(java.io.File fileOrDir)
fileOrDir
- 文件或目录public void addJar(java.net.URL url)
url
- jar urlpublic void addJar(java.io.File file)
file
- jar filepublic void addJar(java.net.URL url, boolean useCaches)
url
- jar urluseCaches
- 是否使用缓存public void removeJar(java.net.URL url)
url
- jar filepublic void removeJar(java.io.File file)
public void close() throws java.io.IOException
close
在接口中 java.io.Closeable
close
在接口中 java.lang.AutoCloseable
close
在类中 java.net.URLClassLoader
java.io.IOException
public java.lang.Class<?> loadClass(java.lang.String clzName) throws java.lang.ClassNotFoundException
loadClass
在类中 java.lang.ClassLoader
clzName
- 类名java.lang.ClassNotFoundException
public static void bindingThread()
public java.util.Enumeration<java.net.URL> getResources(java.lang.String name) throws java.io.IOException
getResources
在类中 java.lang.ClassLoader
java.io.IOException
public java.net.URL getResource(java.lang.String name)
getResource
在类中 java.lang.ClassLoader