Package com.jk.core.resources
Class JKDefaultResourceLoader
java.lang.Object
com.jk.core.resources.JKDefaultResourceLoader
- All Implemented Interfaces:
JKResourceLoader
- Direct Known Subclasses:
JKServletResourceLoader
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 Summary
ConstructorsConstructorDescriptionThis method constructs a newJKDefaultResourceLoader
. -
Method Summary
Modifier and TypeMethodDescriptiongetResourceAsStream
(String resourceName) This method retrieve anInputStream
for reading the specified resource.getResourceUrl
(String fileName) This method retrieve a URL pointing to the location of the specified file resource.
-
Constructor Details
-
JKDefaultResourceLoader
public JKDefaultResourceLoader()This method constructs a newJKDefaultResourceLoader
.
-
-
Method Details
-
getResourceAsStream
This method retrieve anInputStream
for reading the specified resource.- Specified by:
getResourceAsStream
in interfaceJKResourceLoader
- 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
This method retrieve a URL pointing to the location of the specified file resource.- Specified by:
getResourceUrl
in interfaceJKResourceLoader
- 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.
-