public byte[] getBytes() throws IOException { InputStream in = getInputStream(); try { byte[] bytes = IoUtil.getBytes(in); return bytes; } finally { IoUtil.close(in); } }
/** * {@inheritDoc} */ public Enumeration findResources(final String resourceName) throws IOException { // todo this is not right // first get the resources from the parent classloaders Enumeration parentResources = super.findResources(resourceName); // get the classes from my urls Enumeration myResources = resourceFinder.findResources(resourceName); // join the two together Enumeration resources = new UnionEnumeration(parentResources, myResources); return resources; }
/** * {@inheritDoc} */ public URL findResource(final String resourceName) { return resourceFinder.findResource(resourceName); }
@Override public Object run() { return MonoParentJarFileClassLoader.this.resourceFinder.getResource(resourceName); } }, this.acc);
@Override public Object run() { return MonoParentJarFileClassLoader.this.resourceFinder.findResources(resourceName); } }, this.acc);
@Override public Object run() { MonoParentJarFileClassLoader.this.resourceFinder.addUrl(url); return null; } }, this.acc);
/** * {@inheritDoc} */ public URL[] getURLs() { return resourceFinder.getUrls(); }
public MultiParentClassLoader(String name, URL[] urls, ClassLoader[] parents, boolean inverseClassLoading, String[] hiddenClasses, String[] nonOverridableClasses) { super(name, urls); this.parents = copyParents(parents); this.inverseClassLoading = inverseClassLoading; this.hiddenClasses = hiddenClasses; this.nonOverridableClasses = nonOverridableClasses; hiddenResources = toResources(hiddenClasses); nonOverridableResources = toResources(nonOverridableClasses); }
/** * Creates a named class loader as a child of the specified parents. * @param name the name of this class loader * @param urls the urls from which this class loader will classes and resources * @param parents the parents of this class loader */ public JarFileClassLoader(String name, URL[] urls, ClassLoader[] parents) { super(name, EMPTY_URLS, parents); addURLs(urls); }
/** * {@inheritDoc} */ public void destroy() { synchronized(this) { if (destroyed) return; destroyed = true; } ClassLoaderUtil.destroy(this); }
/** * Adds an array of urls to the end of this class loader. * @param urls the URLs to add */ protected void addURLs(final URL[] urls) { resourceFinder.addUrls(urls); }
public JarResourceHandle(JarFile jarFile, JarEntry jarEntry, URL codeSource) throws MalformedURLException { this.jarFile = jarFile; this.jarEntry = jarEntry; this.url = JarFileUrlStreamHandler.createUrl(jarFile, jarEntry, codeSource); this.codeSource = codeSource; }
private Class resolveClass(Class clazz, boolean resolve) { if (resolve) { resolveClass(clazz); } return clazz; }
@Override public Object run() { return MonoParentJarFileClassLoader.this.resourceFinder.findResource(resourceName); } }, this.acc);
@Override public Object run() { return MonoParentJarFileClassLoader.this.resourceFinder.getResource(resourceName); } }, this.acc);
/** * Creates a JarFileClassLoader that is a child of the system class loader. * @param name the name of this class loader * @param urls a list of URLs from which classes and resources should be loaded */ public JarFileClassLoader(String name, URL[] urls) { super(name, EMPTY_URLS); addURLs(urls); }
/** * Creates a JarFileClassLoader that is a child of the specified class loader. * @param name the name of this class loader * @param urls a list of URLs from which classes and resources should be loaded * @param parent the parent of this class loader */ public JarFileClassLoader(String name, URL[] urls, ClassLoader parent) { super(name, EMPTY_URLS, parent); addURLs(urls); }