Class JKDefaultResourceLoader

java.lang.Object
com.jk.core.resources.JKDefaultResourceLoader
All Implemented Interfaces:
JKResourceLoader
Direct Known Subclasses:
JKServletResourceLoader

public class JKDefaultResourceLoader extends Object implements JKResourceLoader
This class is a default implementation of the JKResourceLoader interface that provides methods for loading resources.

This class searches for resources using different class loaders and mechanisms to obtain their InputStream or URL.

Version:
1.0
Author:
Dr. Jalal H. Kiswani
  • Constructor Details

    • JKDefaultResourceLoader

      public JKDefaultResourceLoader()
      This method constructs a new JKDefaultResourceLoader.
  • Method Details

    • getResourceAsStream

      public InputStream getResourceAsStream(String resourceName)
      This method retrieve an InputStream for reading the specified resource.
      Specified by:
      getResourceAsStream in interface JKResourceLoader
      Parameters:
      resourceName - Specifies the name of the resource to be retrieved.
      Returns:
      an InputStream for reading the resource, or null if the resource is not found.
    • getResourceUrl

      public URL getResourceUrl(String fileName)
      This method retrieve a URL pointing to the location of the specified file resource.
      Specified by:
      getResourceUrl in interface JKResourceLoader
      Parameters:
      fileName - Specifies the name of the file resource to be located.
      Returns:
      a URL representing the location of the resource, or null if the resource is not found.