kaos.core.util
Class ResourceLoader

java.lang.Object
  extended by kaos.core.util.ResourceLoader

public class ResourceLoader
extends java.lang.Object

ResourceLoader is a utility class that has methods for retrieving application resources (flat files, Properties files, ResourceBundles, and so on) from an application's CLASSPATH (usually inside a JAR file) using a ClassLoader. Resources may be retrieved as Properties objects or URLs.

Author:
Tom Marrs

Method Summary
static java.util.Properties getAsProperties(java.lang.String name)
          Retrieves a resource for the given name in the CLASSPATH using the specified Class Loader, returning it as a Properties object.
static java.net.URL getAsUrl(java.lang.String name)
          Retrieves a resource for the given name in the CLASSPATH, returning it as an URL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getAsProperties

public static java.util.Properties getAsProperties(java.lang.String name)
Retrieves a resource for the given name in the CLASSPATH using the specified Class Loader, returning it as a Properties object.

Parameters:
name - The resource name.
Returns:
Properties The Properties object for the resource.

getAsUrl

public static java.net.URL getAsUrl(java.lang.String name)
Retrieves a resource for the given name in the CLASSPATH, returning it as an URL.

Parameters:
name - The resource name.
Returns:
URL The URL for reading data from the resource, or null if the resource wan't found.