Class ResourceManager


  • public class ResourceManager
    extends java.lang.Object
    Deprecated.
    Manages resources bundled with an application. Loads resources from the class loader of a given class. This class keeps weak references to the resources it loads so that they may be reused if they have not been garbage collected. This class does have a small overhead of references to resources that are no longer used and have been garbage collected.
    Author:
    Garret Wilson
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.Class loaderClass
      Deprecated.
      The class used for loading resources.
      protected static java.util.Map resourceReferenceMap
      Deprecated.
      The map of references to resources, each keyed to a filename.
    • Constructor Summary

      Constructors 
      Constructor Description
      ResourceManager​(java.lang.Class resourceLoaderClass)
      Deprecated.
      Class constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      java.lang.Object getResource​(java.lang.String filename)
      Deprecated.
      Loads a resource.
      protected java.lang.Object getResource​(java.net.URL url)
      Deprecated.
      Retrieves an object from a URL.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • resourceReferenceMap

        protected static final java.util.Map resourceReferenceMap
        Deprecated.
        The map of references to resources, each keyed to a filename.
      • loaderClass

        protected final java.lang.Class loaderClass
        Deprecated.
        The class used for loading resources.
    • Constructor Detail

      • ResourceManager

        public ResourceManager​(java.lang.Class resourceLoaderClass)
        Deprecated.
        Class constructor.
        Parameters:
        resourceLoaderClass - The class used for loading resources.
    • Method Detail

      • getResource

        public java.lang.Object getResource​(java.lang.String filename)
        Deprecated.
        Loads a resource. The filename may either be the name of a file stored in the same path as the loader class, or the full path to the resource file.

        In most cases, a subclass should not override this method, but instead override getResource(URL), which this method calls.

        Parameters:
        filename - The filename of the resource.
        Returns:
        An object representing the resource.
      • getResource

        protected java.lang.Object getResource​(java.net.URL url)
        Deprecated.
        Retrieves an object from a URL. Each subclass may override this method to do custom loading of the resource.
        Parameters:
        url - The URL of the resource.
        Returns:
        The resource, loaded from the URL.