ResourcesUtils

open class ResourcesUtils<T : Class?>

The ResourcesUtils class is useful to manage the resources folder to get its resources, both with methods working in the JAR scope and both with method working a runtime outside a JAR



     // Invoking a ResourcesUtils method one time
     String resourceContent = ResourcesUtils.getResourceContent("my_path_name.resource", MyCallingClass.class);

     // Invoking a ResourcesUtils methods multiple time is more efficient instantiating a dedicated object
     ResourcesUtils<Class<MyCallingClass>> resourcesUtils = new ResourcesUtils<>(MyCallingClass.class);

     String firstResourceContent = resourcesUtils.getResourceContent("my_first_path_name.resource");

     String secondResourceContent = resourcesUtils.getResourceContent("my_second_path_name.resource");

Author

N7ghtm4r3 - Tecknobit

Since

2.2.2

Parameters

<T>

the class from get its classloader to reach the resources folder

Constructors

Link copied to clipboard
constructor(context: T)
Constructor to init the ResourcesUtils class

Properties

Link copied to clipboard
private val context: T
context the context class from get its classloader to reach the resources folder

Functions

Link copied to clipboard
open fun getResourceContent(pathname: String): String
open fun <T> getResourceContent(pathname: String, context: Class<T>): String
Method to get the content of a resource file
Link copied to clipboard
open fun getResourceFile(pathname: String): File
open fun <T> getResourceFile(pathname: String, context: Class<T>): File
Method to a resource file
Link copied to clipboard
open fun getResourceFileCopy(pathname: String): File
open fun <T> getResourceFileCopy(pathname: String, context: Class<T>): File
Method to get a copy of a resource file
Link copied to clipboard
open fun <T> getResourceFileRuntimeCopy(pathname: String, context: Class<T>): File
Method to get a copy of a resource file during the runtime.
Link copied to clipboard
open fun getResourceStream(pathname: String): InputStream
open fun <T> getResourceStream(pathname: String, context: Class<T>): InputStream
Method to get the stream of a resource file