本文整理了Java中java.lang.ClassLoader.findResources()
方法的一些代码示例,展示了ClassLoader.findResources()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ClassLoader.findResources()
方法的具体详情如下:
包路径:java.lang.ClassLoader
类名称:ClassLoader
方法名:findResources
[英]Finds an enumeration of URLs for the resource with the specified name. This implementation just returns an empty Enumeration; it should be overridden in subclasses.
[中]查找具有指定名称的资源的URL枚举。这个实现只返回一个空枚举;它应该在子类中被重写。
代码示例来源:origin: twosigma/beakerx
@Override
protected Enumeration<URL> findResources(String resource) throws IOException {
List<URL> result = new ArrayList<URL>(Collections.list(super.findResources(resource)));
findResourcesInJarFiles(result, resource);
findResourcesInJavaFileObjectRegistry(result, resource);
return Collections.enumeration(result);
}
代码示例来源:origin: robovm/robovm
/**
* Returns an enumeration of URLs for the resource with the specified name.
* This implementation first uses this class loader's parent to find the
* resource, then it calls {@link #findResources(String)} to get additional
* URLs. The returned enumeration contains the {@code URL} objects of both
* find operations.
*
* @return an enumeration of {@code URL} objects for the requested resource.
* @param resName
* the name of the resource to find.
* @throws IOException
* if an I/O error occurs.
*/
@SuppressWarnings("unchecked")
public Enumeration<URL> getResources(String resName) throws IOException {
Enumeration first = parent.getResources(resName);
Enumeration second = findResources(resName);
return new TwoEnumerationsInOne(first, second);
}
代码示例来源:origin: crashub/crash
@Override
protected Enumeration<URL> findResources(String name) throws IOException {
if ("META-INF/MANIFEST.MF".equals(name)) {
URL u1 = new URL("jar:" + war.toURI().toURL() + "!/META-INF/MANIFEST.MF");
URL u2 = new URL("jar:" + ("jar:" + war.toURI().toURL() + "!/WEB-INF/lib/my.jar") + "!/META-INF/MANIFEST.MF");
return Collections.enumeration(Arrays.asList(u1, u2));
} else if ("java/util".equals(name)) {
String u = "jar:" + ("jar:" + war.toURI().toURL() + "!/WEB-INF/lib/my.jar") + "!/java/util/";
return Collections.enumeration(Collections.singleton(new URL(u)));
} else {
return super.findResources(name);
}
}
};
代码示例来源:origin: com.carecon.fabric3/fabric3-host-api
protected Enumeration<URL> findResources(String name) throws IOException {
if (maskResources) {
return EMPTY;
}
return super.findResources(name);
}
代码示例来源:origin: Silverpeas/Silverpeas-Core
@Override
protected Enumeration<URL> findResources(String name) throws IOException {
return super.findResources(name);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-bootstrap
@Override
public Enumeration<URL> findResources(String name) throws IOException {
return super.findResources(name);
}
代码示例来源:origin: stackoverflow.com
ClassLoader cl = Thread.currentThread().getContextClassLoader();
Enumeration<URL> enm = cl.findResources("META-INF/device-classes.txt");
while (enm.hasMoreElements()) {
runAllClassesIn(enm.nextElement());
}
代码示例来源:origin: org.kantega.reststop/reststop-classloader-utils
@Override
public Enumeration<URL> getResources(String name) throws IOException {
if (isLocalResource(name)) {
return super.findResources(name);
} else {
return super.getResources(name);
}
}
代码示例来源:origin: org.kantega.openaksess/openaksess-core
@Override
public Enumeration<URL> getResources(String name) throws IOException {
if (isLocalResource(name)) {
return super.findResources(name);
} else {
return super.getResources(name);
}
}
代码示例来源:origin: org.netbeans.api/org-netbeans-modules-nbjunit
@Override
public Enumeration<URL> findResources(String name) throws IOException {
if (isUnit(name)) {
return junit.getResources(name);
}
if (name.equals("META-INF/services/java.util.logging.Handler")) { // NOI18N
return junit.getResources("org/netbeans/junit/internal/FakeMetaInf.txt"); // NOI18N
}
return super.findResources(name);
}
代码示例来源:origin: org.jruby/jruby-complete
protected Enumeration<URL> findResources(String name) throws IOException {
Vector<URL> vector = new Vector<URL>();
for (ClassLoader classLoader : classLoaders) {
Enumeration<URL> enumeration = classLoader.getResources(name);
while (enumeration.hasMoreElements()) {
vector.add(enumeration.nextElement());
}
}
Enumeration<URL> enumeration = super.findResources(name);
while (enumeration.hasMoreElements()) {
vector.add(enumeration.nextElement());
}
return vector.elements();
}
代码示例来源:origin: org.jruby/jruby-core
protected Enumeration<URL> findResources(String name) throws IOException {
Vector<URL> vector = new Vector<URL>();
for (ClassLoader classLoader : classLoaders) {
Enumeration<URL> enumeration = classLoader.getResources(name);
while (enumeration.hasMoreElements()) {
vector.add(enumeration.nextElement());
}
}
Enumeration<URL> enumeration = super.findResources(name);
while (enumeration.hasMoreElements()) {
vector.add(enumeration.nextElement());
}
return vector.elements();
}
代码示例来源:origin: kiegroup/droolsjbpm-integration
@Implementation
@Override
protected Enumeration<URL> findResources(String name) throws IOException {
return super.findResources(name);
}
代码示例来源:origin: javapathfinder/jpf-core
@Override
protected Enumeration<URL> findResources(String name) throws IOException {
return super.findResources(name);
}
}
代码示例来源:origin: apache/felix
@Override
protected Enumeration<URL> findResources(String name) throws IOException
{
// Don't try to load resources from the bundle when it is not active
if (bundle.getState() == Bundle.ACTIVE)
{
Enumeration<URL> urls = bundle.getResources(name);
if (urls != null)
{
return urls;
}
}
return super.findResources(name);
}
});
代码示例来源:origin: org.alien4cloud.puccini/puccini-compilation-util
@Override
protected Enumeration<URL> findResources(String resource) throws IOException {
List<URL> result = new ArrayList<URL>(Collections.list(super.findResources(resource)));
findResourcesInJarFiles(result, resource);
findResourcesInJavaFileObjectRegistry(result, resource);
return Collections.enumeration(result);
}
代码示例来源:origin: org.abstractmeta/compilation-toolbox
@Override
protected Enumeration<URL> findResources(String resource) throws IOException {
List<URL> result = new ArrayList<URL>(Collections.list(super.findResources(resource)));
findResourcesInJarFiles(result, resource);
findResourcesInJavaFileObjectRegistry(result, resource);
return Collections.enumeration(result);
}
代码示例来源:origin: co.cask.tigon/tigon-yarn
@Override
public Enumeration<URL> findResources(String name) throws IOException {
if (isValidResource(name)) {
return super.findResources(name);
}
return new CompoundEnumeration<URL>(new Enumeration[0]);
}
代码示例来源:origin: org.apache.tomee/arquillian-openejb-embedded
@Override
protected Enumeration<URL> findResources(final String name) throws IOException {
final List<Archive<?>> node = findNodes(name);
if (!node.isEmpty()) {
final List<URL> urls = new ArrayList<>();
for (final Archive<?> i : node) {
urls.add(new URL(null, "archive:" + i.getName() + (!name.startsWith("/") ? "/" : "") + name, new ArchiveStreamHandler()));
}
return enumerator(urls);
}
return super.findResources(name);
}
代码示例来源:origin: org.apache.openejb/arquillian-openejb-embedded-4
@Override
protected Enumeration<URL> findResources(final String name) throws IOException {
ArchivePath path = ArchivePaths.create(prefix + name);
Node node = archive.get(path);
if (node == null) {
path = ArchivePaths.create(name);
node = archive.get(path);
}
if (node != null) {
return enumerator(new URL(null, "archive:" + archive.getName() + "/" + name, new ArchiveStreamHandler()));
}
return super.findResources(name);
}
内容来源于网络,如有侵权,请联系作者删除!