Class JarClassLoader

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class JarClassLoader
    extends java.net.URLClassLoader
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.HashMap<java.lang.String,​java.lang.Class> cachedClass  
      private java.net.URLClassLoader internalClassLoader  
    • Constructor Summary

      Constructors 
      Constructor Description
      JarClassLoader​(java.lang.ClassLoader c)  
      JarClassLoader​(java.net.URL[] urls)  
      JarClassLoader​(java.net.URL[] arg0, java.lang.ClassLoader arg1)  
      JarClassLoader​(java.net.URL[] arg0, java.lang.ClassLoader arg1, java.net.URLStreamHandlerFactory arg2)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean addJarContext​(java.lang.String context)  
      void clearAllContexts()  
      private java.net.URL contextStringToURL​(java.lang.String context)  
      protected java.lang.Class<?> findClass​(java.lang.String name)  
      java.net.URL findResource​(java.lang.String name)  
      java.util.Enumeration<java.net.URL> findResources​(java.lang.String name)  
      java.net.URL getResource​(java.lang.String name)  
      java.io.InputStream getResourceAsStream​(java.lang.String name)  
      java.util.Enumeration<java.net.URL> getResources​(java.lang.String name)  
      java.net.URL[] getURLs()  
      private void init​(java.net.URL[] arg0, java.lang.ClassLoader arg1, java.net.URLStreamHandlerFactory arg2)  
      boolean isContext​(java.lang.String context)  
      java.lang.Class<?> loadClass​(java.lang.String name)  
      protected java.lang.Class<?> loadClass​(java.lang.String className, boolean resolveIt)  
      static java.net.URLClassLoader newInstance​(java.net.URL[] arg0)  
      boolean removeJarContext​(java.lang.String context)  
      • Methods inherited from class java.net.URLClassLoader

        addURL, close, definePackage, getPermissions, newInstance
      • Methods inherited from class java.security.SecureClassLoader

        defineClass, defineClass
      • 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, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • internalClassLoader

        private java.net.URLClassLoader internalClassLoader
      • cachedClass

        private java.util.HashMap<java.lang.String,​java.lang.Class> cachedClass
    • Constructor Detail

      • JarClassLoader

        public JarClassLoader​(java.lang.ClassLoader c)
                       throws java.net.MalformedURLException
        Throws:
        java.net.MalformedURLException
      • JarClassLoader

        public JarClassLoader​(java.net.URL[] urls)
      • JarClassLoader

        public JarClassLoader​(java.net.URL[] arg0,
                              java.lang.ClassLoader arg1,
                              java.net.URLStreamHandlerFactory arg2)
      • JarClassLoader

        public JarClassLoader​(java.net.URL[] arg0,
                              java.lang.ClassLoader arg1)
    • Method Detail

      • init

        private void init​(java.net.URL[] arg0,
                          java.lang.ClassLoader arg1,
                          java.net.URLStreamHandlerFactory arg2)
      • addJarContext

        public boolean addJarContext​(java.lang.String context)
                              throws java.net.MalformedURLException
        Throws:
        java.net.MalformedURLException
      • removeJarContext

        public boolean removeJarContext​(java.lang.String context)
      • contextStringToURL

        private java.net.URL contextStringToURL​(java.lang.String context)
      • clearAllContexts

        public void clearAllContexts()
      • isContext

        public boolean isContext​(java.lang.String context)
                          throws java.net.MalformedURLException
        Throws:
        java.net.MalformedURLException
      • getResource

        public java.net.URL getResource​(java.lang.String name)
        Overrides:
        getResource in class java.lang.ClassLoader
      • getResourceAsStream

        public java.io.InputStream getResourceAsStream​(java.lang.String name)
        Overrides:
        getResourceAsStream in class java.net.URLClassLoader
      • getResources

        public java.util.Enumeration<java.net.URL> getResources​(java.lang.String name)
                                                         throws java.io.IOException
        Overrides:
        getResources in class java.lang.ClassLoader
        Throws:
        java.io.IOException
      • loadClass

        protected java.lang.Class<?> loadClass​(java.lang.String className,
                                               boolean resolveIt)
                                        throws java.lang.ClassNotFoundException
        Overrides:
        loadClass in class java.lang.ClassLoader
        Throws:
        java.lang.ClassNotFoundException
      • loadClass

        public java.lang.Class<?> loadClass​(java.lang.String name)
                                     throws java.lang.ClassNotFoundException
        Overrides:
        loadClass in class java.lang.ClassLoader
        Throws:
        java.lang.ClassNotFoundException
      • findClass

        protected java.lang.Class<?> findClass​(java.lang.String name)
                                        throws java.lang.ClassNotFoundException
        Overrides:
        findClass in class java.net.URLClassLoader
        Throws:
        java.lang.ClassNotFoundException
      • findResource

        public java.net.URL findResource​(java.lang.String name)
        Overrides:
        findResource in class java.net.URLClassLoader
      • findResources

        public java.util.Enumeration<java.net.URL> findResources​(java.lang.String name)
                                                          throws java.io.IOException
        Overrides:
        findResources in class java.net.URLClassLoader
        Throws:
        java.io.IOException
      • getURLs

        public java.net.URL[] getURLs()
        Overrides:
        getURLs in class java.net.URLClassLoader
      • newInstance

        public static java.net.URLClassLoader newInstance​(java.net.URL[] arg0)