Package com.axelor.common
Class ResourceUtils
- java.lang.Object
-
- com.axelor.common.ResourceUtils
-
public final class ResourceUtils extends Object
The class provides static helper methods to work with resources.
-
-
Constructor Summary
Constructors Constructor Description ResourceUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static PropertiesgetProperties(File file)ReadPropertiesfrom the given file.static PropertiesgetProperties(URL file)ReadPropertiesfrom the given file.static URLgetResource(String location)Finds the resource from the class path with the given location using default ClassLoader.static InputStreamgetResourceStream(String location)Returns an input stream for reading the specified resource.
-
-
-
Method Detail
-
getResource
public static URL getResource(String location)
Finds the resource from the class path with the given location using default ClassLoader.- Parameters:
location- The resource location- Returns:
- an
URLfor reading the resource or null - See Also:
ClassUtils.getDefaultClassLoader(),ClassLoader.getResource(String)
-
getResourceStream
public static InputStream getResourceStream(String location)
Returns an input stream for reading the specified resource.- Parameters:
location- The resource location- Returns:
- An input stream for reading the resource or null
- See Also:
getResource(String),ClassLoader.getResourceAsStream(String)
-
getProperties
public static Properties getProperties(URL file) throws IOException
ReadPropertiesfrom the given file.- Parameters:
file- the properties file url- Returns:
Properties- Throws:
IOException- if unable to read file
-
getProperties
public static Properties getProperties(File file) throws IOException
ReadPropertiesfrom the given file.- Parameters:
file- the properties file url- Returns:
Properties- Throws:
IOException- if unable to read file
-
-