- java.lang.Object
-
- com.aoapps.lang.util.PropertiesUtils
-
public final class PropertiesUtils extends Object
Property utilities.See com.aoapps.servlet.PropertiesUtils for use in servlet environment
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static PropertiesloadFromFile(File file)Loads properties from a file.static PropertiesloadFromResource(Class<?> clazz, String resource)Loads properties from a module or classpath resource.
-
-
-
Field Detail
-
RESOURCES
public static final Resources RESOURCES
-
-
Method Detail
-
loadFromFile
public static Properties loadFromFile(File file) throws IOException
Loads properties from a file.- Throws:
IOException
-
loadFromResource
public static Properties loadFromResource(Class<?> clazz, String resource) throws IOException
Loads properties from a module or classpath resource.- Attempts to locate the resource with
Class.getResourceAsStream(java.lang.String) - If resource name begins with a slash (/):
- Strip all beginning slashes (/) from resource name
-
If
Thread.getContextClassLoader()is non-null, attempts to locate the resource withClassLoader.getResourceAsStream(java.lang.String). -
Otherwise, attempts to locate the resource with
ClassLoader.getSystemResourceAsStream(java.lang.String).
- Throws:
IOException
- Attempts to locate the resource with
-
-