org.ujac.util.io
Class MultiResourceLoader

java.lang.Object
  extended by org.ujac.util.io.MultiResourceLoader
All Implemented Interfaces:
ResourceLoader

public class MultiResourceLoader
extends Object
implements ResourceLoader

Name: MultiResourceLoader
Description: A resource loader loading from multiple nested loaders. It tries all nested loaders in the order they've beem added until the desired resource has been loaded.

Author:
lauerc

Constructor Summary
MultiResourceLoader()
           
 
Method Summary
 void addResourceLoader(ResourceLoader resourceLoader)
          Adds a resource loader.
 byte[] loadResource(String location)
          Loads the resource according to the given location from the nested loaders.
 boolean resourceExists(String location)
          Checks whether or not the desired resource exists.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiResourceLoader

public MultiResourceLoader()
Method Detail

addResourceLoader

public void addResourceLoader(ResourceLoader resourceLoader)
Adds a resource loader.

Parameters:
resourceLoader - The resource loader to add.

loadResource

public byte[] loadResource(String location)
                    throws IOException
Loads the resource according to the given location from the nested loaders. Tries all loaders in the order they've beem added until the desired resource has been loaded.

Specified by:
loadResource in interface ResourceLoader
Parameters:
location - The location of the resource.
Returns:
The loaded resource.
Throws:
IOException - In case the loading of the resource failed.
See Also:
ResourceLoader.loadResource(java.lang.String)

resourceExists

public boolean resourceExists(String location)
Checks whether or not the desired resource exists.

Specified by:
resourceExists in interface ResourceLoader
Parameters:
location - The location of the resource.
Returns:
true in case the given resource could be located, else false.


Copyright © 2003-2004 UJAC.org. All Rights Reserved.