public class ClasspathResourceFinderSimple extends Object implements ClasspathResourceFinder
Same as Class.getResourceAsStream(String) except looks for resources with localized file names.
If the
ClasspathResourceFinder.Null| Modifier and Type | Field and Description |
|---|---|
static ClasspathResourceFinderSimple |
INSTANCE
Reusable instance.
|
| Constructor and Description |
|---|
ClasspathResourceFinderSimple() |
| Modifier and Type | Method and Description |
|---|---|
protected InputStream |
findClasspathResource(Class<?> baseClass,
String name,
Locale locale)
Workhorse method for retrieving a resource from the classpath.
|
InputStream |
findResource(Class<?> baseClass,
String name,
Locale locale)
Returns the contents of the resource with the specified name.
|
protected static Iterable<String> |
getCandidateFileNames(String fileName,
Locale l)
Returns the candidate file names for the specified file name in the specified locale.
|
public static final ClasspathResourceFinderSimple INSTANCE
public ClasspathResourceFinderSimple()
public InputStream findResource(Class<?> baseClass, String name, Locale locale) throws IOException
ClasspathResourceFinderfindResource in interface ClasspathResourceFinderbaseClass - 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 findClasspathResource(Class<?> baseClass, String name, Locale locale) throws IOException
This method can be overridden by subclasses to provide customized handling of resource retrieval from the classpath.
baseClass - The base class providing the classloader.name - The resource name.locale - The resource locale.
IOException - Thrown by underlying stream.protected static Iterable<String> getCandidateFileNames(String fileName, Locale l)
For example, if looking for the
If the locale is
fileName - The name of the file to get candidate file names on.l - The locale.
Copyright © 2016–2019 The Apache Software Foundation. All rights reserved.