List of utility methods to do Resource Find
URL | findResource(Class> clazz) find Resource if (clazz.isArray()) { clazz = clazz.getComponentType(); if (clazz.isPrimitive()) { return null; ClassLoader loader = (clazz.getClassLoader() != null ? clazz.getClassLoader() : ClassLoader.getSystemClassLoader()); ... |
URL | findResource(Class> clazz) find Resource if (clazz.isArray()) clazz = clazz.getComponentType(); if (clazz.isPrimitive()) return null; URL url = getClassLoader(clazz).getResource(toResourceName(clazz)); String path = url.toString(); if (path.indexOf(' ') != -1) { try { ... |
URL | findResource(String name) XXX Abstraction around how we find resources, do something smarter in the future. return ClassLoader.getSystemResource(name);
|
String | findResource(String resource, ClassLoader classLoader) find Resource String urls = ""; URL url = classLoader.getResource(resource); if (url == null) { urls = "\t" + resource + " not found\n"; } else { urls = "\t" + url.toString() + "\n"; Enumeration<?> en = classLoader.getResources(resource); ... |
URL | findResourceBase(String baseResource, ClassLoader loader) Find the classpath URL for a specific classpath resource. URL url = loader.getResource(baseResource);
return findResourceBase(url, baseResource);
|
URL[] | findResourceBases(String baseResource, ClassLoader loader) Find the classpath URLs for a specific classpath resource. ArrayList<URL> list = new ArrayList<URL>(); try { Enumeration<URL> urls = loader.getResources(baseResource); while (urls.hasMoreElements()) { URL url = urls.nextElement(); list.add(findResourceBase(url, baseResource)); } catch (IOException e) { ... |
List | findResources(String name) find Resources try { Enumeration<URL> resources = Thread.currentThread().getContextClassLoader().getResources(name); List<URL> ret = new ArrayList<URL>(); while (resources.hasMoreElements()) { ret.add(resources.nextElement()); return ret; } catch (IOException e) { ... |