public class ClasspathResourceFinderBasic extends ClasspathResourceFinderSimple
Same as ClasspathResourceFinderSimple
, but first searches the working directory for the file before
looking in the classpath.
Path traversals outside the working directory are not allowed for security reasons.
ClasspathResourceFinder.Null
Modifier and Type | Field and Description |
---|---|
static ClasspathResourceFinderBasic |
INSTANCE
Reusable instance.
|
Constructor and Description |
---|
ClasspathResourceFinderBasic() |
Modifier and Type | Method and Description |
---|---|
protected InputStream |
findFileSystemResource(String name,
Locale locale)
Workhorse method for retrieving a resource from the file system.
|
InputStream |
findResource(Class<?> baseClass,
String name,
Locale locale)
Returns the contents of the resource with the specified name.
|
findClasspathResource, getCandidateFileNames
public static final ClasspathResourceFinderBasic INSTANCE
public ClasspathResourceFinderBasic()
public InputStream findResource(Class<?> baseClass, String name, Locale locale) throws IOException
ClasspathResourceFinder
findResource
in interface ClasspathResourceFinder
findResource
in class ClasspathResourceFinderSimple
baseClass
- The class to use to retrieve the resource.name
- The resource name.
See Class.getResource(String)
for format.locale
- The locale of the resource to retrieve.
IOException
- Thrown by underlying stream.protected InputStream findFileSystemResource(String name, Locale locale) throws IOException
This method can be overridden by subclasses to provide customized handling of resource retrieval from file systems.
name
- The resource name.locale
- The resource locale.
IOException
- Thrown by underlying stream.Copyright © 2016–2019 The Apache Software Foundation. All rights reserved.