Package pro.gravit.utils
Class PublicURLClassLoader
- java.lang.Object
-
- java.lang.ClassLoader
-
- java.security.SecureClassLoader
-
- java.net.URLClassLoader
-
- pro.gravit.utils.PublicURLClassLoader
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class PublicURLClassLoader extends java.net.URLClassLoader
-
-
Constructor Summary
Constructors Constructor Description PublicURLClassLoader(java.net.URL[] urls)Constructs a new URLClassLoader for the specified URLs using the default delegation parentClassLoader.PublicURLClassLoader(java.net.URL[] urls, java.lang.ClassLoader parent)Constructs a new URLClassLoader for the given URLs.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddURL(java.net.URL url)-
Methods inherited from class java.net.URLClassLoader
close, definePackage, findClass, findResource, findResources, getPermissions, getResourceAsStream, getURLs, newInstance, newInstance
-
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResource, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
-
-
-
Constructor Detail
-
PublicURLClassLoader
public PublicURLClassLoader(java.net.URL[] urls)
Constructs a new URLClassLoader for the specified URLs using the default delegation parentClassLoader. The URLs will be searched in the order specified for classes and resources after first searching in the parent class loader. Any URL that ends with a '/' is assumed to refer to a directory. Otherwise, the URL is assumed to refer to a JAR file which will be downloaded and opened as needed.If there is a security manager, this method first calls the security manager's
checkCreateClassLoadermethod to ensure creation of a class loader is allowed.- Parameters:
urls- the URLs from which to load classes and resources- Throws:
java.lang.SecurityException- if a security manager exists and itscheckCreateClassLoadermethod doesn't allow creation of a class loader.java.lang.NullPointerException- ifurlsisnull.- See Also:
SecurityManager.checkCreateClassLoader()
-
PublicURLClassLoader
public PublicURLClassLoader(java.net.URL[] urls, java.lang.ClassLoader parent)Constructs a new URLClassLoader for the given URLs. The URLs will be searched in the order specified for classes and resources after first searching in the specified parent class loader. Anyjar:scheme URL is assumed to refer to a JAR file. Anyfile:scheme URL that ends with a '/' is assumed to refer to a directory. Otherwise, the URL is assumed to refer to a JAR file which will be downloaded and opened as needed.If there is a security manager, this method first calls the security manager's
checkCreateClassLoadermethod to ensure creation of a class loader is allowed.- Parameters:
urls- the URLs from which to load classes and resourcesparent- the parent class loader for delegation- Throws:
java.lang.SecurityException- if a security manager exists and itscheckCreateClassLoadermethod doesn't allow creation of a class loader.java.lang.NullPointerException- ifurlsisnull.- See Also:
SecurityManager.checkCreateClassLoader()
-
-