public class DefaultClassPathResourceLoader extends Object implements ClassPathResourceLoader
| Constructor and Description |
|---|
DefaultClassPathResourceLoader(ClassLoader classLoader)
Default constructor.
|
DefaultClassPathResourceLoader(ClassLoader classLoader,
String basePath)
Use when resources should have a standard base path.
|
DefaultClassPathResourceLoader(ClassLoader classLoader,
String basePath,
boolean checkBase)
Use when resources should have a standard base path.
|
| Modifier and Type | Method and Description |
|---|---|
ResourceLoader |
forBase(String basePath)
Constructs a new resource loader designed to load
resources from the given path.
|
ClassLoader |
getClassLoader() |
Optional<URL> |
getResource(String path)
Obtains a resource URL.
|
Optional<InputStream> |
getResourceAsStream(String path)
Obtains a resource as a stream.
|
Stream<URL> |
getResources(String path)
Obtains a stream of resource URLs.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdefaultLoader, supportsPrefixpublic DefaultClassPathResourceLoader(ClassLoader classLoader)
classLoader - The class loader for loading resourcespublic DefaultClassPathResourceLoader(ClassLoader classLoader, String basePath)
classLoader - The class loader for loading resourcesbasePath - The path to look for resources underpublic DefaultClassPathResourceLoader(ClassLoader classLoader, String basePath, boolean checkBase)
classLoader - The class loader for loading resourcesbasePath - The path to look for resources undercheckBase - If set to true an extended check for the base path is performed otherwise paths with relative URLs like ../ are prohibited.public Optional<InputStream> getResourceAsStream(String path)
getResourceAsStream in interface ResourceLoaderpath - The pathpublic Optional<URL> getResource(String path)
getResource in interface ResourceLoaderpath - The pathpublic Stream<URL> getResources(String path)
getResources in interface ResourceLoaderpath - The pathpublic ClassLoader getClassLoader()
getClassLoader in interface ClassPathResourceLoaderpublic ResourceLoader forBase(String basePath)
ResourceLoaderforBase in interface ResourceLoaderbasePath - The path to load resources