Class MultiFormatResourceLocator

java.lang.Object
com.ardor3d.util.resource.SimpleResourceLocator
com.ardor3d.util.resource.MultiFormatResourceLocator
All Implemented Interfaces:
ResourceLocator

public class MultiFormatResourceLocator extends SimpleResourceLocator
This class extends the behavior of the SimpleResourceLocator by replacing the resource's file extension with different various provided extensions. If none of these work, it will try the original resource name as-is. You can choose to have the original file searched for first, or last using setTrySpecifiedFormatFirst(boolean).
  • Constructor Details

    • MultiFormatResourceLocator

      public MultiFormatResourceLocator(URI baseDir, String... extensions) throws URISyntaxException
      Construct a new MultiFormatResourceLocator using the given URI as our context and the list of possible extensions as extensions to try during file search.
      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.
      extensions - an array of extensions (eg. ".png", ".dds", ".tga", etc.) to try while searching for a resource with this locator. This is done by replacing any existing extension in the resource name with each of the given extensions.
      Throws:
      URISyntaxException - if the given URI does not end in / and we can not make a new URI with a trailing / from it.
    • MultiFormatResourceLocator

      public MultiFormatResourceLocator(URL baseDir, String... extensions) throws URISyntaxException
      Construct a new MultiFormatResourceLocator using the given URL as our context and the list of possible extensions as extensions to try during file search.
      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.
      extensions - an array of extensions (eg. ".png", ".dds", ".tga", etc.) to try while searching for a resource with this locator. This is done by replacing any existing extension in the resource name with each of the given extensions.
      Throws:
      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