I wrote some methods to achive these needs.
private Properties readFromPropertiesFile() {
// Read properties file.
Properties prop = new Properties();
try {
prop.load(new FileInputStream("data.properties"));
} catch (IOException e) {
}
return prop;
}
private void writeToPropertiesFile(Properties prop) {
// Write properties file.
try {
prop.store(new FileOutputStream("data.properties"), null);
} catch (IOException e) {
}
}
private String readKey(Properties prop, String key)
{
return prop.getProperty(key);
}
private void writeKey(Properties prop, String key, String value)
{
prop.setProperty(key, value);
}
Hiç yorum yok:
Yorum Gönder