Package com.ardor3d.util.resource
Class SimpleResourceLocator
java.lang.Object
com.ardor3d.util.resource.SimpleResourceLocator
- All Implemented Interfaces:
ResourceLocator
- Direct Known Subclasses:
MultiFormatResourceLocator
This locator takes a base location for finding resources specified with a relative path. If it cannot find the path
relative to the location, 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.
-
Constructor Summary
ConstructorDescriptionSimpleResourceLocator
(URI baseDir) Construct a new SimpleResourceLocator using the given URI as our context.SimpleResourceLocator
(URL baseDir) Construct a new SimpleResourceLocator using the given URL as our context. -
Method Summary
Modifier and TypeMethodDescriptionprotected String
protected ResourceSource
doRecursiveLocate
(String resourceName) boolean
int
hashCode()
locateResource
(String resourceName) Locates a resource according to the strategy of the resource locator implementation (subclass).protected String
trimResourceName
(String resourceName)
-
Constructor Details
-
SimpleResourceLocator
Construct a new SimpleResourceLocator using the given URI as our context.- Parameters:
baseDir
- our base context. This is meant to be a "directory" wherein we will search for resources. Therefore, if it does not end in /, a / will be added to ensure we are talking about children of the given baseDir.- Throws:
NullPointerException
- if the given URI is null.URISyntaxException
- if the given URI does not end in / and we can not make a new URI with a trailing / from it.
-
SimpleResourceLocator
Construct a new SimpleResourceLocator using the given URL as our context.- Parameters:
baseDir
- our base context. This is converted to a URI. This is meant to be a "directory" wherein we will search for resources. Therefore, if it does not end in /, a / will be added to ensure we are talking about children of the given baseDir.- Throws:
NullPointerException
- if the given URL is null.URISyntaxException
- if this URL can not be converted to a URI, or if the converted URI does not end in / and we can not make a new URI with a trailing / from it.
-
-
Method Details
-
getBaseDir
-
locateResource
Description copied from interface:ResourceLocator
Locates a resource according to the strategy of the resource locator implementation (subclass).- Specified by:
locateResource
in interfaceResourceLocator
- Parameters:
resourceName
- the name of the resource to locate; it this is a path it must be slash separated (no backslashes)- Returns:
- a source for the resource, null if the resource was not found
- See Also:
-
doRecursiveLocate
-
trimResourceName
-
cleanup
-
equals
-
hashCode
public int hashCode()
-