| Modifier and Type | Field and Description |
|---|---|
private java.lang.ClassLoader |
classLoader
Class loader used to get input streams on classpath locations.
|
private java.lang.String |
classPath
Classpath location of resource.
|
| Constructor and Description |
|---|
ClassPathResource(java.lang.String path)
Creates a new resource that reads from the given classpath location.
|
ClassPathResource(java.lang.String path,
java.lang.ClassLoader loader)
Creates a new resource that reads from the given classpath location.
|
| Modifier and Type | Method and Description |
|---|---|
java.io.InputStream |
getInputStream()
Gets an input stream around the resource.
|
private final java.lang.String classPath
private final java.lang.ClassLoader classLoader
public ClassPathResource(java.lang.String path)
Thread.currentThread().getContextClassLoader() is used to obtain the class loader used to obtain an input
stream on the given classpath.path - Classpath location.public ClassPathResource(java.lang.String path,
java.lang.ClassLoader loader)
path - Classpath location.loader - Class loader used to obtain an input stream on the given classpath location.public java.io.InputStream getInputStream()
ResourceInputStream.close() unless otherwise noted.
Implementers should produce a new instance on every call to this method to provide for thread-safe usage patterns on a shared resource.
getInputStream in interface Resource