ResourceUtilspublic class ResourceUtils extends Object ResourceUtils. Provide a set of convenience methods for working with
Resources. |
Methods Summary |
---|
public static java.io.InputStream | getResourceAsStream(java.lang.Object object, org.apache.log4j.lf5.util.Resource resource)Get the InputStream for this resource. Note: to convert an InputStream
into an InputReader, use: new InputStreamReader(InputStream).
ClassLoader loader = object.getClass().getClassLoader();
InputStream in = null;
if (loader != null) {
in = loader.getResourceAsStream(resource.getName());
} else {
in = ClassLoader.getSystemResourceAsStream(resource.getName());
}
return in;
| public static java.net.URL | getResourceAsURL(java.lang.Object object, org.apache.log4j.lf5.util.Resource resource)Get the URL for this resource.
ClassLoader loader = object.getClass().getClassLoader();
URL url = null;
if (loader != null) {
url = loader.getResource(resource.getName());
} else {
url = ClassLoader.getSystemResource(resource.getName());
}
return (url);
|
|