mirror of
https://github.com/corda/corda.git
synced 2025-01-06 05:04:20 +00:00
add ClassLoader.getResources calls
This commit is contained in:
parent
03b66375f4
commit
a50fda1a5e
@ -13,6 +13,10 @@ package java.lang;
|
||||
import java.io.InputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
|
||||
public abstract class ClassLoader {
|
||||
private final ClassLoader parent;
|
||||
@ -123,4 +127,24 @@ public abstract class ClassLoader {
|
||||
public static InputStream getSystemResourceAsStream(String path) {
|
||||
return getSystemClassLoader().getResourceAsStream(path);
|
||||
}
|
||||
|
||||
public static Enumeration<URL> getSystemResources(String name) throws IOException {
|
||||
return getSystemClassLoader().getResources(name);
|
||||
}
|
||||
|
||||
public Enumeration<URL> getResources(String name)
|
||||
throws IOException {
|
||||
Collection<URL> resources = collectResources(name);
|
||||
return Collections.enumeration(resources);
|
||||
}
|
||||
|
||||
private Collection<URL> collectResources(String name) {
|
||||
Collection<URL> urls = parent != null ? parent.collectResources(name) : new ArrayList<URL>(5);
|
||||
URL url = findResource(name);
|
||||
if (url != null) {
|
||||
urls.add(url);
|
||||
}
|
||||
return urls;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user