public class ClassPathResource extends Object implements Resource
InputStream
from a classpath resource.Constructor and Description |
---|
ClassPathResource(String path)
Creates a new resource that reads from the given classpath location.
|
ClassPathResource(String path,
ClassLoader loader)
Creates a new resource that reads from the given classpath location.
|
Modifier and Type | Method and Description |
---|---|
InputStream |
getInputStream()
Gets an input stream around the resource.
|
public ClassPathResource(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(String path, ClassLoader loader)
path
- Classpath location.loader
- Class loader used to obtain an input stream on the given
classpath location.public InputStream getInputStream()
InputStream.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
Copyright © 2016 JBoss by Red Hat. All rights reserved.