java.net.URLClassLoader.getResources()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(147)

本文整理了Java中java.net.URLClassLoader.getResources()方法的一些代码示例,展示了URLClassLoader.getResources()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。URLClassLoader.getResources()方法的具体详情如下:
包路径:java.net.URLClassLoader
类名称:URLClassLoader
方法名:getResources

URLClassLoader.getResources介绍

暂无

代码示例

代码示例来源:origin: prestodb/presto

@Override
public Enumeration<URL> getResources(String name)
    throws IOException
{
  // If this is an SPI resource, use SPI resources
  if (isSpiClass(name)) {
    return spiClassLoader.getResources(name);
  }
  // Use local resources
  return super.getResources(name);
}

代码示例来源:origin: alibaba/jstorm

public Enumeration<URL> getResources(String name) throws IOException {
  Enumeration<URL>[] tmp = (Enumeration<URL>[]) new Enumeration<?>[2];
  tmp[0] = super.getResources(name);
  tmp[1] = defaultClassLoader.getResources(name);
  return new CompoundEnumeration<>(tmp);
}

代码示例来源:origin: alibaba/jvm-sandbox

@Override
public Enumeration<URL> getResources(String name) throws IOException {
  Enumeration<URL> urls = findResources(name);
  if( null != urls ) {
    return urls;
  }
  urls = super.getResources(name);
  return urls;
}

代码示例来源:origin: alibaba/jvm-sandbox

@Override
public Enumeration<URL> getResources(String name) throws IOException {
  Enumeration<URL> urls = findResources(name);
  if( null != urls ) {
    return urls;
  }
  urls = super.getResources(name);
  return urls;
}

代码示例来源:origin: apache/incubator-druid

@Override
 public Enumeration<URL> getResources(final String name) throws IOException
 {
  final List<URL> urls = new ArrayList<>();
  Iterators.addAll(urls, Iterators.forEnumeration(super.getResources(name)));
  Iterators.addAll(urls, Iterators.forEnumeration(druidLoader.getResources(name)));
  return Iterators.asEnumeration(urls.iterator());
 }
}

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testGetResourcesNull() throws Exception {
 resourceName = "null_resource";
 Enumeration<URL> resources = ucl.getResources(resourceName);
 List<URL> list = Collections.list(resources);
 assertEquals(0, list.size());
 resources = icl.getResources(resourceName);
 list = Collections.list(resources);
 assertEquals(0, list.size());
}

代码示例来源:origin: eclipse-vertx/vert.x

@Test
public void testGetResources() throws Exception {
 Enumeration<URL> resources = ucl.getResources(resourceName);
 List<URL> list = Collections.list(resources);
 assertEquals(2, list.size());
 checkResource(url2, list.get(0));
 checkResource(url3, list.get(1));
 resources = icl.getResources(resourceName);
 list = Collections.list(resources);
 assertEquals(3, list.size());
 checkResource(url1, list.get(0));
 checkResource(url2, list.get(1));
 checkResource(url3, list.get(2));
}

代码示例来源:origin: openmrs/openmrs-core

for (Enumeration<URL> en = super.getResources(packageName); en.hasMoreElements();) {
  URL url = en.nextElement();
  try {

代码示例来源:origin: io.vertx/vertx-core

@Test
public void testGetResourcesNull() throws Exception {
 resourceName = "null_resource";
 Enumeration<URL> resources = ucl.getResources(resourceName);
 List<URL> list = Collections.list(resources);
 assertEquals(0, list.size());
 resources = icl.getResources(resourceName);
 list = Collections.list(resources);
 assertEquals(0, list.size());
}

代码示例来源:origin: io.vertx/vertx-core

@Test
public void testGetResources() throws Exception {
 Enumeration<URL> resources = ucl.getResources(resourceName);
 List<URL> list = Collections.list(resources);
 assertEquals(2, list.size());
 checkResource(url2, list.get(0));
 checkResource(url3, list.get(1));
 resources = icl.getResources(resourceName);
 list = Collections.list(resources);
 assertEquals(3, list.size());
 checkResource(url1, list.get(0));
 checkResource(url2, list.get(1));
 checkResource(url3, list.get(2));
}

代码示例来源:origin: org.jboss.cdi.tck/cdi-tck-impl

@Override
  public Enumeration<URL> getResources(String name) throws IOException {
    if ("META-INF/services/javax.enterprise.inject.spi.Extension".equals(name)) {
      // Load only AlphaExtension
      return super.getResources("META-INF/services/" + MyExtension.class.getName());
    }
    return super.getResources(name);
  }
};

代码示例来源:origin: triplea-game/triplea

private List<URL> getMatchingResources(final String path) {
 try {
  return Collections.list(loader.getResources(path));
 } catch (final IOException e) {
  throw new IllegalStateException(e);
 }
}

代码示例来源:origin: org.codehaus.plexus/plexus-classworlds

public Enumeration<URL> getResources( String name )
  throws IOException
{
  Collection<URL> resources = new LinkedHashSet<URL>( Collections.list( super.getResources( name ) ) );
  resources.addAll( Collections.list( strategy.getResources( name ) ) );
  return Collections.enumeration( resources );
}

代码示例来源:origin: com.haulmont.cuba/cuba-core

@Override
public Enumeration<URL> getResources(String name) throws IOException {
  URL url = getOrmXmlUrl(name);
  if (url != null)
    return Collections.enumeration(Collections.singletonList(url));
  else
    return super.getResources(name);
}

代码示例来源:origin: io.prestosql/presto-main

@Override
public Enumeration<URL> getResources(String name)
    throws IOException
{
  // If this is an SPI resource, use SPI resources
  if (isSpiClass(name)) {
    return spiClassLoader.getResources(name);
  }
  // Use local resources
  return super.getResources(name);
}

代码示例来源:origin: prestosql/presto

@Override
public Enumeration<URL> getResources(String name)
    throws IOException
{
  // If this is an SPI resource, use SPI resources
  if (isSpiClass(name)) {
    return spiClassLoader.getResources(name);
  }
  // Use local resources
  return super.getResources(name);
}

代码示例来源:origin: org.terracotta/terracotta-toolkit-runtime

@Override
public Enumeration<URL> getResources(String name) throws IOException {
 Enumeration<URL> resources = urlClassLoader.getResources(name);
 if (resources != null && resources.hasMoreElements()) { return resources; }
 resources = super.getResources(name);
 if (resources != null && resources.hasMoreElements()) { return resources; }
 return appLoader.getResources(name);
}

代码示例来源:origin: com.alibaba.jstorm/jstorm-core

public Enumeration<URL> getResources(String name) throws IOException {
  Enumeration<URL>[] tmp = (Enumeration<URL>[]) new Enumeration<?>[2];
  tmp[0] = super.getResources(name);
  tmp[1] = defaultClassLoader.getResources(name);
  return new CompoundEnumeration<>(tmp);
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

@Override
public Enumeration<URL> getResources(String resName) throws IOException {
    HashSet<URL> resourceSet = findResourceSet(resName);
  addEnumerationToCollection(resourceSet, super.getResources(resName));
  
  return Collections.enumeration(resourceSet);
}

代码示例来源:origin: alipay/sofa-ark

@Override
  public Enumeration<URL> getResources(String name) throws IOException {
    Handler.setUseFastConnectionExceptions(true);
    try {
      return new UseFastConnectionExceptionsEnumeration(super.getResources(name));
    } finally {
      Handler.setUseFastConnectionExceptions(false);
    }
  }
}

相关文章