org.eclipse.actf.util.resources
Interface IResourceLocator

All Known Implementing Classes:
DefaultResourceLocator, EclipseResourceLocator, InterJvmResourceLocator

public interface IResourceLocator

A IResourceLocator is used to retreave streams for named resources. It is meant to enhance the normal functionality of ClassLoader.getResourceAsStream() in contexts in which classpaths can be difficult to resolve or are unknown.

Author:
Barry Feigenbaum

Field Summary
static String ACTF_RESOURCES_PATHS_KEY
           
static String DEFAULT_ACTF_RESOURCES_DIR
           
 
Method Summary
 String getPath(String name)
          find the Path with the given name.
 String[] getPaths(String name)
          find the paths with the given name.
 URL getResource(String name)
          find the resource with the given name.
 InputStream getResourceAsStream(String id)
          get the resource with the given id as a stream and using the class loader that loaded this IResourceLocator instance.
 InputStream getResourceAsStream(String id, ClassLoader loader)
          get the resource corresponding to the given id as a stream using the specified class loader.
 InputStream getResourceAsStream(String id, String base, String ext, ClassLoader loader)
          get the resource corresponding to the given id as a stream using the specified class loader.
 URL[] getResources(String name)
          find the resources with the given name.
 

Field Detail

DEFAULT_ACTF_RESOURCES_DIR

static final String DEFAULT_ACTF_RESOURCES_DIR
See Also:
Constant Field Values

ACTF_RESOURCES_PATHS_KEY

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

getResourceAsStream

InputStream getResourceAsStream(String id)
get the resource with the given id as a stream and using the class loader that loaded this IResourceLocator instance.

Parameters:
id - - id of resource
Returns:
input stream

getResourceAsStream

InputStream getResourceAsStream(String id,
                                ClassLoader loader)
get the resource corresponding to the given id as a stream using the specified class loader.

Parameters:
id - - id of resource
loader - -- class loader to use
Returns:
input stream

getResourceAsStream

InputStream getResourceAsStream(String id,
                                String base,
                                String ext,
                                ClassLoader loader)
get the resource corresponding to the given id as a stream using the specified class loader. The base path and extention of the file resource are also specified.

Parameters:
id - - id of resource
loader - -- class loader to use
base - - base path
ext - -extentio
Returns:
input streamn

getResource

URL getResource(String name)
find the resource with the given name. The name is a /-separated path describing the relative path to the resource.

Parameters:
name - - name of resource
Returns:
URL of a resource with the given name or null if no resources with the given name could be found
See Also:
ClassLoader.getResource(String)

getResources

URL[] getResources(String name)
find the resources with the given name. The name is a /-separated path describing the relative path to the resource.

Parameters:
name - - name of resource
Returns:
URL of all resources with the given name or null if no resources with the given name could be found
See Also:
ClassLoader.getResources(String)

getPath

String getPath(String name)
find the Path with the given name. The name is a /-separated path describing the relative path to the resource.

Parameters:
name - - name of resource
Returns:
String file representation of the URL returned from getResources or null if no resources with the given name could be found
See Also:
ClassLoader.getResource(String)

getPaths

String[] getPaths(String name)
find the paths with the given name. The name is a /-separated path describing the relative path to the resource.

Parameters:
name - - name of resource
Returns:
String[] file representation of the URL[] returned from getResources or null if no resources with the given name could be found
See Also:
ClassLoader.getResources(String)