|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.yajul.util.ResourceUtil
public class ResourceUtil
Provides utility methods for finding and loading resources. User: josh Date: Sep 20, 2003 Time: 7:06:23 PM
Constructor Summary | |
---|---|
ResourceUtil()
|
Method Summary | |
---|---|
static boolean |
exists(java.lang.String name)
Returns true if the specified resource exists. |
static java.io.InputStream |
getResourceAsStream(java.lang.String resourceName)
Returns an input stream for the named resource, or null if it was not found. |
static java.util.Properties |
loadProperties(java.lang.String resourceName)
Loads a properties resource. |
static java.util.Properties |
loadProperties(java.lang.String resourceName,
java.util.Properties defaults,
java.lang.Class aClass)
Loads a properties resource. |
static byte[] |
resourceAsBytes(java.lang.String name)
Returns the resource as a byte array. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ResourceUtil()
Method Detail |
---|
public static java.util.Properties loadProperties(java.lang.String resourceName) throws java.io.IOException
resourceName
- The name of the resource.
java.io.IOException
- if the resource could not be parsedpublic static java.util.Properties loadProperties(java.lang.String resourceName, java.util.Properties defaults, java.lang.Class aClass) throws java.io.IOException
resourceName
- The name of the resource.defaults
- A set of default properties, for 'layering' of properties files.
See http://www.javaworld.com/javaworld/javatips/jw-javatip135.html?page=1aClass
- optional class for loading properties inside a package. If this is specified (not null)
the resource name will be loaded from the same class loader and package as this class. The package path
will automatically be added to the resource name in this case.
java.io.IOException
- if the resource could not be parsedpublic static java.io.InputStream getResourceAsStream(java.lang.String resourceName)
resourceName
- The name of the resource
public static byte[] resourceAsBytes(java.lang.String name) throws java.io.IOException
name
- The resource name.
java.io.IOException
- if anything goes wrong.public static boolean exists(java.lang.String name)
name
- The resource name
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |