- java.lang.Object
-
- com.pervasive.datarush.commons.util.PropertiesFileUtil
-
public class PropertiesFileUtil extends Object
Utility methods to consume properties files.
-
-
Constructor Summary
Constructors Constructor Description PropertiesFileUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Properties
read(File propertiesFile)
Loads a.properties
-formatted file from disk into aProperties
object.static Properties
read(String propertiesPath)
Loads a.properties
-formatted file from disk into aProperties
object.static void
write(File propertiesFile, Properties data, String comment)
Writes aProperties
object to disk.static void
write(String propertiesPath, Properties data, String comment)
Writes aProperties
object to disk.
-
-
-
Method Detail
-
read
public static Properties read(String propertiesPath)
Loads a.properties
-formatted file from disk into aProperties
object. On error, the input stream is properly closed and a user-friendly exception is thrown.- Parameters:
propertiesPath
- the path to the file to load- Returns:
- a
Properties
object populated with the specified file's data
-
read
public static Properties read(File propertiesFile)
Loads a.properties
-formatted file from disk into aProperties
object. On error, the input stream is properly closed and a user-friendly exception is thrown.- Parameters:
propertiesFile
- the file to load- Returns:
- a
Properties
object populated with the specified file's data
-
write
public static void write(String propertiesPath, Properties data, String comment)
Writes aProperties
object to disk. On error, the output stream is properly closed and a user-friendly exception is thrown.- Parameters:
propertiesPath
- the path to the file to writedata
- theProperties
object to storecomment
- an optional comment to include at the top of the written file
-
write
public static void write(File propertiesFile, Properties data, String comment)
Writes aProperties
object to disk. On error, the output stream is properly closed and a user-friendly exception is thrown.- Parameters:
propertiesFile
- the file to writedata
- theProperties
object to storecomment
- an optional comment to include at the top of the written file
-
-