Class ResourcesUtils


  • public class ResourcesUtils
    extends Object

    Utility class providing handy methods to deal with Resources.

    Author:
    https://github.com/mcweba [Marc-Andre Weber]
    • Method Detail

      • loadResource

        public static String loadResource​(String resourceName,
                                          boolean exceptionWhenNotFound)

        Loads the resource with the provided name from the classpath. When param exceptionWhenNotFound set to true, a RuntimeException is thrown when the resource cannot be loaded.

        Parameters:
        resourceName - the name of the resource to load
        exceptionWhenNotFound - throw a RuntimeException when the resource could not be loaded
        Returns:
        The content of the resource or null
        Throws:
        RuntimeException - when exceptionWhenNotFound is set to true and resource cannot be loaded