com.jme.util.resource
Class SimpleResourceLocator

java.lang.Object
  extended by com.jme.util.resource.SimpleResourceLocator
All Implemented Interfaces:
ResourceLocator
Direct Known Subclasses:
MultiFormatResourceLocator

public class SimpleResourceLocator
extends java.lang.Object
implements ResourceLocator

This locator takes a base URL for finding resources specified with a relative path. If it cannot find the path relative to the URL, it successively omits the starting components of the relative path until it can find a resources with such a trimmed path. If no resource is found with this method null is returned.

Author:
Joshua Slack

Field Summary
protected  java.net.URI baseDir
           
 
Constructor Summary
SimpleResourceLocator(java.net.URI baseDir)
           
SimpleResourceLocator(java.net.URL baseDir)
           
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.net.URL locateResource(java.lang.String resourceName)
          Locates a resource according to the strategy of the resource locator implementation (subclass).
protected  java.lang.String trimResourceName(java.lang.String resourceName)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

baseDir

protected java.net.URI baseDir
Constructor Detail

SimpleResourceLocator

public SimpleResourceLocator(java.net.URI baseDir)

SimpleResourceLocator

public SimpleResourceLocator(java.net.URL baseDir)
                      throws java.net.URISyntaxException
Throws:
java.net.URISyntaxException
Method Detail

locateResource

public java.net.URL locateResource(java.lang.String resourceName)
Description copied from interface: ResourceLocator
Locates a resource according to the strategy of the resource locator implementation (subclass).

Specified by:
locateResource in interface ResourceLocator
Parameters:
resourceName - the name of the resource to locate; it this is a path it must be slash separated (no backslashes)
Returns:
a URL for the resource, null if the resource was not found
See Also:
SimpleResourceLocator, MultiFormatResourceLocator

trimResourceName

protected java.lang.String trimResourceName(java.lang.String resourceName)

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object