ProgramixGenericLib v5.0.1

com.programix.io
Interface IOTools.ResourceLocator

All Known Implementing Classes:
IOTools.BaseDirectoryResourceLocator, IOTools.ClassLoaderResourceLocator, IOTools.ServletResourceLocator
Enclosing class:
IOTools

public static interface IOTools.ResourceLocator

A ResourceLocator is used to assist in finding and opening InputStream's and URL's for an application based on the resources name. One or more ResourceLocator's can be added to the VM-wide way that IOTools locates resources.

Author:
Paul Hyde

Method Summary
 InputStream getInputStreamForResource(String resourceLocation)
          Returns an InputStream that gets its bytes from the specified resource.
 URL getUrlForResource(String resourceLocation)
          Returns a URL that gets its bytes from the specified resource.
 

Method Detail

getInputStreamForResource

InputStream getInputStreamForResource(String resourceLocation)
Returns an InputStream that gets its bytes from the specified resource. A return value of null indicates that the resource could not be found (do not throw an exception as the search may continue on to other locators). A return value of null can also be used to indicate that this particular locator can not supply the resource in the desired format (for example, it can not be returned as a URL, but it might be able to be returned as an InputStream).

Parameters:
resourceLocation - the name of the resource to find.
Returns:
the InputStream or null if the specified resource could not be found by this locator.

getUrlForResource

URL getUrlForResource(String resourceLocation)
Returns a URL that gets its bytes from the specified resource. A return value of null indicates that the resource could not be found (do not throw an exception as the search may continue on to other locators). A return value of null can also be used to indicate that this particular locator can not supply the resource in the desired format (for example, it can not be returned as an URL, but it might be able to be returned as an InputStream).

Parameters:
resourceLocation - the name of the resource to find.
Returns:
the URL or null if the specified resource could not be found by this locator.

ProgramixGenericLib v5.0.1

Copyright © 2001-2009 Programix Incorporated. All rights reserved. ProgramixGenericLib is free and is OSI Certified Open Source Software under the BSD license.