com.jme.util.resource
Class MultiFormatResourceLocator

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

public class MultiFormatResourceLocator
extends SimpleResourceLocator

This class extends the behavior of the SimpleResourceLocator by appending different file extensions to the resource name, if it cannot find a resource with the extension specified in the path name.

Author:
Joshua Slack

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

Constructor Detail

MultiFormatResourceLocator

public MultiFormatResourceLocator(java.net.URI baseDir)

MultiFormatResourceLocator

public MultiFormatResourceLocator(java.net.URL baseDir)
                           throws java.net.URISyntaxException
Throws:
java.net.URISyntaxException

MultiFormatResourceLocator

public MultiFormatResourceLocator(java.net.URI baseDir,
                                  java.lang.String... extensions)

MultiFormatResourceLocator

public MultiFormatResourceLocator(java.net.URL baseDir,
                                  java.lang.String... extensions)
                           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
Overrides:
locateResource in class SimpleResourceLocator
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

isTrySpecifiedFormatFirst

public boolean isTrySpecifiedFormatFirst()

setTrySpecifiedFormatFirst

public void setTrySpecifiedFormatFirst(boolean trySpecifiedFormatFirst)

equals

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