Class ResourceUtils


  • public abstract class ResourceUtils
    extends java.lang.Object
    Utilities for manipulating resource paths and URLs.
    Since:
    1.0.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String ALL_CLASSPATH_URL_PREFIX
      Pseudo URL prefix for loading all resources from the class path: "classpath*:".
      static java.lang.String CLASSPATH_URL_PREFIX
      Pseudo URL prefix for loading from the class path: "classpath:".
      static java.lang.String FILE_URL_PREFIX
      URL prefix for loading from the file system: "file:".
    • Constructor Summary

      Constructors 
      Constructor Description
      ResourceUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.List<java.lang.String> getUrls​(java.lang.String path, java.lang.ClassLoader classLoader)
      Return URLs from a given source path.
      • Methods inherited from class java.lang.Object

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

      • CLASSPATH_URL_PREFIX

        public static final java.lang.String CLASSPATH_URL_PREFIX
        Pseudo URL prefix for loading from the class path: "classpath:".
        See Also:
        Constant Field Values
      • ALL_CLASSPATH_URL_PREFIX

        public static final java.lang.String ALL_CLASSPATH_URL_PREFIX
        Pseudo URL prefix for loading all resources from the class path: "classpath*:".
        See Also:
        Constant Field Values
      • FILE_URL_PREFIX

        public static final java.lang.String FILE_URL_PREFIX
        URL prefix for loading from the file system: "file:".
        See Also:
        Constant Field Values
    • Constructor Detail

      • ResourceUtils

        public ResourceUtils()
    • Method Detail

      • getUrls

        public static java.util.List<java.lang.String> getUrls​(java.lang.String path,
                                                               java.lang.ClassLoader classLoader)
        Return URLs from a given source path. Source paths can be simple file locations (/some/file.java) or wildcard patterns (/some/**). Additionally the prefixes "file:", "classpath:" and "classpath*:" can be used for specific path types.
        Parameters:
        path - the source path
        classLoader - the class loader or null to use the default
        Returns:
        a list of URLs