Class ResourceLocatorTool

java.lang.Object
com.ardor3d.util.resource.ResourceLocatorTool

public class ResourceLocatorTool extends Object
Manager class for locator utility classes used to find various assets. (XXX: Needs more documentation)
  • Field Details

  • Constructor Details

    • ResourceLocatorTool

      public ResourceLocatorTool()
  • Method Details

    • locateResource

      public static ResourceSource locateResource(String resourceType, String resourceName)
    • addResourceLocator

      public static void addResourceLocator(String resourceType, ResourceLocator locator)
    • removeResourceLocator

      public static boolean removeResourceLocator(String resourceType, ResourceLocator locator)
    • getClassPathResource

      public static URL getClassPathResource(Class<?> clazz, String name)
      Locate a resource using various classloaders.
      • First it tries the Thread.currentThread().getContextClassLoader().
      • Then it tries the ClassLoader.getSystemClassLoader() (if not same as context class loader).
      • Finally it tries the clazz.getClassLoader()
      Parameters:
      clazz - a class to use as a local reference.
      name - the name and path of the resource.
      Returns:
      the URL of the resource, or null if none found.
    • getClassPathResourceAsStream

      public static InputStream getClassPathResourceAsStream(Class<?> clazz, String name)
      Locate a resource using various classloaders and open a stream to it.
      Parameters:
      clazz - a class to use as a local reference.
      name - the name and path of the resource.
      Returns:
      the input stream if resource is found, or null if not.
    • getClassPathResources

      public static Set<URL> getClassPathResources(Class<?> clazz, String name)
      Locate all instances of a resource using various classloaders.
      Parameters:
      clazz - a class to use as a local reference.
      name - the name and path of the resource.
      Returns:
      a set containing the located URLs of the named resource.