public final class ClasspathResourceManager extends Object
Constructor and Description |
---|
ClasspathResourceManager(Class<?> baseClass)
Constructor.
|
ClasspathResourceManager(Class<?> baseClass,
ClasspathResourceFinder resourceFinder,
boolean useCache)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
InputStream |
getStream(Class<?> baseClass,
String name,
Locale locale)
Finds the resource with the given name for the specified locale and returns it as an input stream.
|
InputStream |
getStream(String name)
Finds the resource with the given name.
|
InputStream |
getStream(String name,
Locale locale)
Finds the resource with the given name for the specified locale and returns it as an input stream.
|
String |
getString(Class<?> baseClass,
String name)
Finds the resource with the given name and converts it to a simple string.
|
String |
getString(Class<?> baseClass,
String name,
Locale locale)
Finds the resource with the given name and converts it to a simple string.
|
String |
getString(String name)
Finds the resource with the given name and converts it to a simple string.
|
String |
getString(String name,
Locale locale)
Finds the resource with the given name and converts it to a simple string.
|
public ClasspathResourceManager(Class<?> baseClass, ClasspathResourceFinder resourceFinder, boolean useCache)
baseClass
- The default class to use for retrieving resources from the classpath.resourceFinder
- The resource finder implementation.useCache
- If public ClasspathResourceManager(Class<?> baseClass)
Uses default ClasspathResourceFinderBasic
for finding resources.
baseClass
- The default class to use for retrieving resources from the classpath.public InputStream getStream(String name) throws IOException
name
- Name of the desired resource.IOException
- Thrown by underlying stream.public InputStream getStream(String name, Locale locale) throws IOException
name
- Name of the desired resource.locale
- The locale. Can be IOException
- Thrown by underlying stream.public InputStream getStream(Class<?> baseClass, String name, Locale locale) throws IOException
baseClass
- Overrides the default class to use for retrieving the classpath resource.
name
- Name of the desired resource.locale
- The locale. Can be IOException
- Thrown by underlying stream.public String getString(String name) throws IOException
name
- Name of the desired resource.IOException
- Thrown by underlying stream.public String getString(Class<?> baseClass, String name) throws IOException
baseClass
- Overrides the default class to use for retrieving the classpath resource.
name
- Name of the desired resource.IOException
- Thrown by underlying stream.public String getString(String name, Locale locale) throws IOException
name
- Name of the desired resource.locale
- The locale. Can be IOException
- Thrown by underlying stream.public String getString(Class<?> baseClass, String name, Locale locale) throws IOException
baseClass
- Overrides the default class to use for retrieving the classpath resource.
name
- Name of the desired resource.locale
- The locale. Can be IOException
- Thrown by underlying stream.Copyright © 2016–2019 The Apache Software Foundation. All rights reserved.