Class ResourceUtil


  • public final class ResourceUtil
    extends Object
    The ResourceUtil class is a utility class which provides methods for working with resources.
    Author:
    Marcus Portmann
    • Constructor Detail

      • ResourceUtil

        public ResourceUtil()
    • Method Detail

      • classpathResourceExists

        public static boolean classpathResourceExists​(String path)
        Confirms whether the resource with the specified path exists on the classpath using the context class loader.
        Parameters:
        path - the classpath path for the resource
        Returns:
        true if the resource with the specified path exists on the classpath or false otherwise.
      • getClasspathResource

        public static byte[] getClasspathResource​(String path)
        Retrieves the resource with the specified path on the classpath using the context class loader.
        Parameters:
        path - the path to the resource on the classpath
        Returns:
        the resource with the specified path on the classpath using the context class loader
      • getClasspathResourceURL

        public static URL getClasspathResourceURL​(String path)
        Retrieves the URL for the resource with the specified path on the classpath using the context class loader.
        Parameters:
        path - the path to the resource on the classpath
        Returns:
        the URL for the resource with the specified path on the classpath using the context class loader
      • getStringClasspathResource

        public static String getStringClasspathResource​(String path)
        Retrieves the resource with the specified path on the classpath using the context class loader.
        Parameters:
        path - the path to the resource on the classpath
        Returns:
        the resource with the specified path on the classpath using the context class loader