public final class MetaResource
extends java.lang.Object
MetaClass
Constructor and Description |
---|
MetaResource(java.lang.ClassLoader classLoader,
java.lang.String path)
Creates an MetaResource instance.
|
Modifier and Type | Method and Description |
---|---|
java.lang.ClassLoader |
getClassLoader()
Gets the classloader.
|
java.io.InputStream |
getInputStream()
Looks up a resource, and opens a resource stream on it starting at the
classloader passed in.
|
java.lang.String |
getResourcePath()
Gets the resource path.
|
java.net.URL |
toURL()
Looks up a resource, starting at the classloader passed in.
|
public MetaResource(java.lang.ClassLoader classLoader, java.lang.String path)
classLoader
- the classloader that should load the resourcepath
- the relative path to the resource e.g. "images/foo.png"java.lang.NullPointerException
- when either the classloader or the path are
null
.public java.net.URL toURL()
null
if it
does notpublic java.io.InputStream getInputStream() throws java.io.IOException
InputStream
of the resource if it
exists or null
if it does notjava.io.IOException
- if the openStream failed for whatever reasonpublic java.lang.String getResourcePath()
public java.lang.ClassLoader getClassLoader()