com.jeta.open.resources
Interface ResourceLoader

All Known Implementing Classes:
AppResourceLoader

public interface ResourceLoader

Defines a set of methods used to load resources such as images, property files, and other types of files from the CLASSPATH. It provides a layer of abstraction so the application is not bound to a particular loading stategy. Note that a full ClassLoader could be used instead, but this is a little easier to code with.


Field Summary
static String COMPONENT_ID
           
 
Method Summary
 ClassLoader getClassLoader()
          Used to provide a custom class loader for certain cases.
 InputStream getResourceAsStream(String resourceName)
          Opens and returns an input stream for the given resourceName.
 ImageIcon loadImage(String imageName)
          Utility method that loads an image from the CLASSPATH.
 void setClassLoader(ClassLoader loader)
          Used to provide a custom class loader for certain cases.
 

Field Detail

COMPONENT_ID

static final String COMPONENT_ID
See Also:
Constant Field Values
Method Detail

getResourceAsStream

InputStream getResourceAsStream(String resourceName)
                                throws IOException
Opens and returns an input stream for the given resourceName. The resourceName is relative to the application CLASSPATH (i.e. JAR file).

Parameters:
resourceName - the relative name of the resource to open
Returns:
an input stream for the given resourceName.
Throws:
IOException

getClassLoader

ClassLoader getClassLoader()
Used to provide a custom class loader for certain cases. This is especially useful during development when we want the resource bundles to be loaded from the source directories or if you want to provide a custom class loader.


loadImage

ImageIcon loadImage(String imageName)
Utility method that loads an image from the CLASSPATH.

Parameters:
imageName - the subdirectory and name of image file (i.e. images/edit16.gif )

setClassLoader

void setClassLoader(ClassLoader loader)
Used to provide a custom class loader for certain cases. This is especially useful during development when we want the resource bundles to be loaded from the source directories



Copyright © 2005-2007 Jeff Tassin & Todd Viegut. All Rights Reserved.