/// <summary> /// Constructs a new URLClassLoader for the specified URLs, parent /// class loader, and URLStreamHandlerFactory. The parent argument /// will be used as the parent class loader for delegation. The /// factory argument will be used as the stream handler factory to /// obtain protocol handlers when creating new jar URLs. /// /// <para>If there is a security manager, this method first /// calls the security manager's {@code checkCreateClassLoader} method /// to ensure creation of a class loader is allowed. /// /// </para> /// </summary> /// <param name="urls"> the URLs from which to load classes and resources </param> /// <param name="parent"> the parent class loader for delegation </param> /// <param name="factory"> the URLStreamHandlerFactory to use when creating URLs /// </param> /// <exception cref="SecurityException"> if a security manager exists and its /// {@code checkCreateClassLoader} method doesn't allow /// creation of a class loader. </exception> /// <exception cref="NullPointerException"> if {@code urls} is {@code null}. </exception> /// <seealso cref= SecurityManager#checkCreateClassLoader </seealso> public URLClassLoader(URL[] urls, ClassLoader parent, URLStreamHandlerFactory factory) : base(parent) { // this is to make the stack depth consistent with 1.1 SecurityManager security = System.SecurityManager; if (security != null) { security.CheckCreateClassLoader(); } Ucp = new URLClassPath(urls, factory); Acc = AccessController.Context; }
internal URLClassLoader(URL[] urls, ClassLoader parent, AccessControlContext acc) : base(parent) { // this is to make the stack depth consistent with 1.1 SecurityManager security = System.SecurityManager; if (security != null) { security.CheckCreateClassLoader(); } Ucp = new URLClassPath(urls); this.Acc = acc; }
/// <summary> /// Constructs a new URLClassLoader for the specified URLs using the /// default delegation parent {@code ClassLoader}. 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. /// /// <para>If there is a security manager, this method first /// calls the security manager's {@code checkCreateClassLoader} method /// to ensure creation of a class loader is allowed. /// /// </para> /// </summary> /// <param name="urls"> the URLs from which to load classes and resources /// </param> /// <exception cref="SecurityException"> if a security manager exists and its /// {@code checkCreateClassLoader} method doesn't allow /// creation of a class loader. </exception> /// <exception cref="NullPointerException"> if {@code urls} is {@code null}. </exception> /// <seealso cref= SecurityManager#checkCreateClassLoader </seealso> public URLClassLoader(URL[] urls) : base() { // this is to make the stack depth consistent with 1.1 SecurityManager security = System.SecurityManager; if (security != null) { security.CheckCreateClassLoader(); } Ucp = new URLClassPath(urls); this.Acc = AccessController.Context; }