Class ResourcesUtils


  • public class ResourcesUtils
    extends java.lang.Object

    Utility class providing handy methods to deal with Resources.

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

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String loadResource​(java.lang.String resourceName, boolean exceptionWhenNotFound)
      Loads the resource with the provided name from the classpath.
      • Methods inherited from class java.lang.Object

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

      • loadResource

        public static java.lang.String loadResource​(java.lang.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:
        java.lang.RuntimeException - when exceptionWhenNotFound is set to true and resource cannot be loaded