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 Properties
getProperties(File file)
ReadProperties
from the given file.static Properties
getProperties(URL file)
ReadProperties
from the given file.static URL
getResource(String location)
Finds the resource from the class path with the given location using default ClassLoader.static InputStream
getResourceStream(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
URL
for 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
ReadProperties
from 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
ReadProperties
from the given file.- Parameters:
file
- the properties file url- Returns:
Properties
- Throws:
IOException
- if unable to read file
-
-