ProgramixGenericLib v5.0.1

com.programix.io
Class IOTools.ClassLoaderResourceLocator

java.lang.Object
  extended by com.programix.io.IOTools.ClassLoaderResourceLocator
All Implemented Interfaces:
IOTools.ResourceLocator
Enclosing class:
IOTools

public static class IOTools.ClassLoaderResourceLocator
extends Object
implements IOTools.ResourceLocator

An implementation of IOTools.ResourceLocator that uses the specified Class to try to locate resources.

Author:
Paul Hyde

Constructor Summary
IOTools.ClassLoaderResourceLocator(Class<?> searchStartPoint)
           
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IOTools.ClassLoaderResourceLocator

public IOTools.ClassLoaderResourceLocator(Class<?> searchStartPoint)
Method Detail

getInputStreamForResource

public InputStream getInputStreamForResource(String resourceLocation)
Description copied from interface: IOTools.ResourceLocator
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).

Specified by:
getInputStreamForResource in interface IOTools.ResourceLocator
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

public URL getUrlForResource(String resourceLocation)
Description copied from interface: IOTools.ResourceLocator
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).

Specified by:
getUrlForResource in interface IOTools.ResourceLocator
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.