|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.qedeq.base.io.ResourceLoaderUtility
public final class ResourceLoaderUtility
Utility methods for accessing classes and resources using an appropriate class loader. Adapted from org.apache.myfaces.trinidad.util.ClassLoaderUtils.
Method Summary | |
---|---|
static java.lang.ClassLoader |
getContextClassLoader()
Dynamically accesses the current context class loader. |
static java.io.InputStream |
getResourceAsStream(java.lang.String name)
Locates the stream resource with the specified name. |
static java.io.InputStream |
getResourceAsStream(java.lang.String name,
java.lang.ClassLoader callerClassLoader)
Locates the resource stream with the specified name. |
static java.io.File |
getResourceFile(java.io.File startDirectory,
java.lang.String resourceDirectoryName,
java.lang.String resourceName)
Get resource file. |
static java.net.URL |
getResourceUrl(java.lang.String name)
Locates the resource with the specified name. |
static java.net.URL |
getResourceUrl(java.lang.String name,
java.lang.ClassLoader callerClassLoader)
Locates the resource with the specified name. |
static java.lang.Class |
loadClass(java.lang.String name)
Loads the class with the specified name. |
static java.lang.Class |
loadClass(java.lang.String name,
java.lang.ClassLoader callerClassLoader)
Loads the class with the specified name. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static java.lang.Class loadClass(java.lang.String name) throws java.lang.ClassNotFoundException
name
- Name of class to load.
Class
object
java.lang.ClassNotFoundException
- Class was not found.public static java.net.URL getResourceUrl(java.lang.String name)
name
- Resource name.
URL
object. Maybe null
.public static java.io.InputStream getResourceAsStream(java.lang.String name)
name
- the name of the resource
InputStream
objectpublic static java.lang.Class loadClass(java.lang.String name, java.lang.ClassLoader callerClassLoader) throws java.lang.ClassNotFoundException
name
- the name of the classcallerClassLoader
- the calling class loader context
Class
object
java.lang.ClassNotFoundException
- if the class was not foundpublic static java.net.URL getResourceUrl(java.lang.String name, java.lang.ClassLoader callerClassLoader)
name
- the name of the resourcecallerClassLoader
- the calling class loader context
URL
objectpublic static java.io.InputStream getResourceAsStream(java.lang.String name, java.lang.ClassLoader callerClassLoader)
name
- the name of the resourcecallerClassLoader
- the calling class loader context
InputStream
objectpublic static java.lang.ClassLoader getContextClassLoader()
null
if there is
no per-thread context class loader. Also if the JRE is below 1.2 or something else went wrong
the method returns null
.
public static java.io.File getResourceFile(java.io.File startDirectory, java.lang.String resourceDirectoryName, java.lang.String resourceName)
startDirectory
- Start looking from this directory.resourceDirectoryName
- Within this directory
(relative to startDirectory
).resourceName
- Look for this resource file.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |