Package org.openxava.util
Class Resources
java.lang.Object
org.openxava.util.Resources
- Author:
- Javier Paniza
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic InputStreamgetAsStreamInPrefixes(String resourceName, String... prefixes) Load the resource as a stream from classpath, looking for all path prefixes until find it in one.static StringloadAsString(Class baseClass, String resourceName) Load a resource from the classpath and return it in String format.static StringloadAsString(String fileName) Load a resource from the file system and return it in String format.
-
Constructor Details
-
Resources
public Resources()
-
-
Method Details
-
loadAsString
Load a resource from the classpath and return it in String format.- Parameters:
baseClass- Base class from start the search of resource.resourceName-- Throws:
IOException
-
loadAsString
Load a resource from the file system and return it in String format.- Throws:
IOException
-
getAsStreamInPrefixes
Load the resource as a stream from classpath, looking for all path prefixes until find it in one. For example, the next code:
Resources.getAsStreamInPrefixes("Customer.jrxml", "/reports/", "/informes/", "/")Look for /reports/Customer.jrxml, if not found for /informes/Customer.jrmxl, if not found for /Customer.jrxml.- Parameters:
resourceName- The name of the resource in classpath, a file name.prefixes- A list of path prefixes, to look for each one.- Returns:
- The stream to get resource content, or null if not found.
- Since:
- 7.0
-