com.lyrisoft.util.io
Class ResourceLoader
java.lang.Object
|
+--com.lyrisoft.util.io.ResourceLoader
- public class ResourceLoader
- extends java.lang.Object
A class that loads resources from locations relative to the
CLASSPATH, or relative to the ServletContext if one is specified.
$Id: ResourceLoader.html,v 1.1 2002/02/10 00:10:04 taso Exp $
Constructor Summary |
protected |
ResourceLoader()
All static class - don't instantiate |
Method Summary |
static java.io.InputStream |
getResource(java.lang.String relativePath)
Load a resource from the CLASSPATH. |
static void |
setServletContext(javax.servlet.ServletContext context)
|
static java.net.URL |
touch(java.lang.String relativePath)
Brings a resource into existence if it does not already exist. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ResourceLoader
protected ResourceLoader()
- All static class - don't instantiate
setServletContext
public static void setServletContext(javax.servlet.ServletContext context)
getResource
public static java.io.InputStream getResource(java.lang.String relativePath)
throws ResourceException
- Load a resource from the CLASSPATH. relativePath should use forward-slashes
and omit the first slash.
e.g., getResource("path/to/my/resource");
- Parameters:
relativePath
-
touch
public static java.net.URL touch(java.lang.String relativePath)
throws ResourceException
- Brings a resource into existence if it does not already exist.
This is useful when running within a servlet context, to pop
the log files into existence before trying to use them.
Copyright © 2000-2002 Taso Lyristis