public class ShrinkWrapClassLoader
extends java.net.URLClassLoader
implements java.io.Closeable
close()
to free resources.Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
EMPTY
Empty String
|
private static java.util.logging.Logger |
log
Logger
|
private java.util.List<java.io.InputStream> |
openedStreams
List of all streams opened, such that they may be closed in
close() . |
Constructor and Description |
---|
ShrinkWrapClassLoader(Archive<?>... archives)
Constructs a new ShrinkWrapClassLoader for the specified
Archive s using the default delegation parent
ClassLoader . |
ShrinkWrapClassLoader(java.lang.ClassLoader parent,
Archive<?>... archives)
Constructs a new ShrinkWrapClassLoader for the given
Archive s. |
Modifier and Type | Method and Description |
---|---|
private void |
addArchive(Archive<?> archive) |
private void |
addArchives(Archive<?>[] archives) |
void |
close() |
addURL, definePackage, findClass, findResource, findResources, getPermissions, getResourceAsStream, getURLs, newInstance, newInstance
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
private static final java.util.logging.Logger log
private static final java.lang.String EMPTY
private final java.util.List<java.io.InputStream> openedStreams
close()
. Guarded by
"this".public ShrinkWrapClassLoader(Archive<?>... archives)
Archive
s using the default delegation parent
ClassLoader
. The Archive
s will be searched in the order specified for classes and resources
after first searching in the parent class loader.archives
- the Archive
s from which to load classes and resourcespublic ShrinkWrapClassLoader(java.lang.ClassLoader parent, Archive<?>... archives)
Archive
s. The Archive
s will be searched in
the order specified for classes and resources after first searching in the specified parent class loader.parent
- the parent class loader for delegationarchives
- the Archive
s from which to load classes and resourcesprivate void addArchives(Archive<?>[] archives)
private void addArchive(Archive<?> archive)
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.net.URLClassLoader
java.io.IOException