org.ocltf.utils
Class FileResourceUtils

java.lang.Object
  extended byorg.ocltf.utils.FileResourceUtils

public class FileResourceUtils
extends java.lang.Object

Provides utilities for loading resources using ClassLoaders.

Author:
Chad Brandon

Constructor Summary
FileResourceUtils()
           
 
Method Summary
static java.net.URL getClassResource(java.lang.Class clazz)
          Takes a Class as an argument and returns the URL for the class.
static java.net.URL getClassResource(java.lang.String className)
          Takes a className as an argument and returns the URL for the class.
static java.net.URL getPackageResource(java.lang.Class clazz)
          Takes a package as an argument and returns the URL for the package.
static java.net.URL getPackageResource(java.lang.String packageName)
          Takes a packageName as an argument and returns the URL for the class.
static java.net.URL getResource(java.lang.String resourceName)
          Retrieves aresource from the class package
static java.lang.String getResourceContentsAsString(java.lang.String resourceName)
          Loads the file resource and returns the contents as a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileResourceUtils

public FileResourceUtils()
Method Detail

getResource

public static java.net.URL getResource(java.lang.String resourceName)
Retrieves aresource from the class package

Parameters:
resourceName - - the name of the resource
Returns:
java.net.URL

getPackageResource

public static java.net.URL getPackageResource(java.lang.Class clazz)
Takes a package as an argument and returns the URL for the package.

Parameters:
clazz - - the Class to load as a resource
Returns:
java.net.URL

getClassResource

public static java.net.URL getClassResource(java.lang.Class clazz)
Takes a Class as an argument and returns the URL for the class.

Parameters:
clazz - - the Class to load as a resource
Returns:
java.net.URL

getClassResource

public static java.net.URL getClassResource(java.lang.String className)
Takes a className as an argument and returns the URL for the class.

Parameters:
className -
Returns:
java.net.URL

getPackageResource

public static java.net.URL getPackageResource(java.lang.String packageName)
Takes a packageName as an argument and returns the URL for the class.

Parameters:
packageName -
Returns:
java.net.URL

getResourceContentsAsString

public static java.lang.String getResourceContentsAsString(java.lang.String resourceName)
Loads the file resource and returns the contents as a String.

Parameters:
resourceName - the name of the resource.
Returns:
String


Copyright © 2003-2004 Chad Brandon. All Rights Reserved.