Package jodd.util
Class ResourcesUtil
java.lang.Object
jodd.util.ResourcesUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic InputStreamgetResourceAsStream(String resourceName) Opens a resource of the specified name for reading.static InputStreamgetResourceAsStream(String resourceName, ClassLoader callingClass) Opens a resource of the specified name for reading.static InputStreamgetResourceAsStream(String resourceName, ClassLoader callingClass, boolean useCache) Opens a resource of the specified name for reading.static StringgetResourceAsString(String resourceName) static URLgetResourceUrl(String resourceName) Retrieves given resource as URL.static URLgetResourceUrl(String resourceName, ClassLoader classLoader) Retrieves given resource as URL.
-
Constructor Details
-
ResourcesUtil
public ResourcesUtil()
-
-
Method Details
-
getResourceUrl
Retrieves given resource as URL.- See Also:
-
getResourceUrl
Retrieves given resource as URL. Resource is always absolute and may starts with a slash character.Resource will be loaded using class loaders in the following order:
Thread.currentThread().getContextClassLoader()ClassLoaderUtil.class.getClassLoader()- if
callingClassis provided:callingClass.getClassLoader()
-
getResourceAsString
- Throws:
IOException
-
getResourceAsStream
Opens a resource of the specified name for reading.- Throws:
IOException- See Also:
-
getResourceAsStream
public static InputStream getResourceAsStream(String resourceName, ClassLoader callingClass) throws IOException Opens a resource of the specified name for reading.- Throws:
IOException- See Also:
-
getResourceAsStream
public static InputStream getResourceAsStream(String resourceName, ClassLoader callingClass, boolean useCache) throws IOException Opens a resource of the specified name for reading. Controls caching, that is important when the same jar is reloaded using custom classloader.- Throws:
IOException
-