org.licas.util.classloader

## Class UrlJarClassLoader

- java.lang.Object
- - java.lang.ClassLoader
  - - java.security.SecureClassLoader
    - - java.net.URLClassLoader
      - - org.licas.util.classloader.UrlJarClassLoader

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

      public class UrlJarClassLoader
      extends java.net.URLClassLoader

  This is a URL class loader, extended to also read a local jar file for class names retrieval.
  Author:
    Kieran Greer

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `UrlJarClassLoader(java.net.URL[] uris)` Create a new instance of UrlJarClassLoader.
    `UrlJarClassLoader(java.net.URL[] uris, java.lang.ClassLoader parent)` Create a new instance of UrlJarClassLoader.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addURL(java.net.URL url)` Add a url to the classpath.
    `java.util.ArrayList<java.lang.String>` | `getAllClasses(java.lang.String jarUri, boolean rtnOnError)` Retrieve and return the names of all classes stored in the jar identified by the uri.

    - ### Methods inherited from class java.net.URLClassLoader

      `close, definePackage, findClass, findResource, findResources, getPermissions, getResourceAsStream, getURLs, newInstance, newInstance`

    - ### Methods inherited from class java.security.SecureClassLoader

      `defineClass, defineClass`

    - ### Methods inherited from class java.lang.ClassLoader

      `clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getResource, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### UrlJarClassLoader

          public UrlJarClassLoader(java.net.URL[] uris)

      Create a new instance of UrlJarClassLoader.
      Parameters:
        `uris` - list of jar uris. Should only be one, but need array for parent constructor.

    - #### UrlJarClassLoader

          public UrlJarClassLoader(java.net.URL[] uris,
                                   java.lang.ClassLoader parent)

      Create a new instance of UrlJarClassLoader.
      Parameters:
        `uris` - list of jar uris. Should only be one, but need array for parent constructor.
        `parent` - the parent class loader. Can be null.

  - ### Method Detail

    - #### addURL

          public void addURL(java.net.URL url)

      Add a url to the classpath.
      Overrides:
        `addURL` in class `java.net.URLClassLoader`
      Parameters:
        `url` - the url address.

    - #### getAllClasses

          public java.util.ArrayList<java.lang.String> getAllClasses(java.lang.String jarUri,
                                                                     boolean rtnOnError)

      Retrieve and return the names of all classes stored in the jar identified by the uri. This does not add the jar as a permanent class loader. It only parses it to retrieve the class list. Use 'addLoader' or 'loadObject' to add as a permanent loader.
      Parameters:
        `jarUri` - the uri for the jar file.
        `rtnOnError` - if true, exit with the first load error, returning null. If false, try to load every class and ignore any errors.
      Returns:
        a list of all class names.