public static URL getResourceURL(ClassLoader loader, String resource) throws IOException { URL url = classLoaderWrapper.getResourceAsURL(resource, loader); if (url == null) { throw new IOException("Could not find resource " + resource); } return url; }
/** * Returns the URL of the resource on the classpath * * @param loader The classloader used to fetch the resource * @param resource The resource to find * @return The resource * @throws java.io.IOException If the resource cannot be found or read */ public static URL getResourceURL(ClassLoader loader, String resource) throws IOException { URL url = classLoaderWrapper.getResourceAsURL(resource, loader); if (url == null) { throw new IOException("Could not find resource " + resource); } return url; }
/** * Get a resource as a URL using the current class path * * @param resource - the resource to locate * @return the resource or null */ public URL getResourceAsURL(String resource) { return getResourceAsURL(resource, getClassLoaders(null)); }
/** * Get a resource from the classpath, starting with a specific class loader * * @param resource - the resource to find * @param classLoader - the first classloader to try * @return the stream or null */ public URL getResourceAsURL(String resource, ClassLoader classLoader) { return getResourceAsURL(resource, getClassLoaders(classLoader)); }
public URL getResourceAsURL(String resource) { return getResourceAsURL(resource, getClassLoaders(null)); }
public URL getResourceAsURL(String resource, ClassLoader classLoader) { return getResourceAsURL(resource, getClassLoaders(classLoader)); }
/** * Returns the URL of the resource on the classpath * * @param resource The resource to find * @return The resource * @throws java.io.IOException If the resource cannot be found or read */ public static URL getResourceURL(String resource) throws IOException { return classLoaderWrapper.getResourceAsURL(resource); }
/** * Returns the URL of the resource on the classpath * * @param loader The classloader used to fetch the resource * @param resource The resource to find * @return The resource * @throws java.io.IOException If the resource cannot be found or read */ public static URL getResourceURL(ClassLoader loader, String resource) throws IOException { URL url = classLoaderWrapper.getResourceAsURL(resource, loader); if (url == null) throw new IOException("Could not find resource " + resource); return url; }
/** * Get a resource as a URL using the current class path * * @param resource - the resource to locate * @return the resource or null */ public URL getResourceAsURL(String resource) { return getResourceAsURL(resource, new ClassLoader[]{ defaultClassLoader, Thread.currentThread().getContextClassLoader(), getClass().getClassLoader(), ClassLoader.getSystemClassLoader() }); }
/** * Get a resource from the classpath, starting with a specific class loader * * @param resource - the resource to find * @param classLoader - the first classloader to try * @return the stream or null */ public URL getResourceAsURL(String resource, ClassLoader classLoader) { return getResourceAsURL(resource, new ClassLoader[]{ classLoader, defaultClassLoader, Thread.currentThread().getContextClassLoader(), getClass().getClassLoader(), ClassLoader.getSystemClassLoader() }); }