Example #1
0
 public Map<String, String> getPropertiesFile(String fileName) throws Exception {
   if ((new File(fileName + ".properties")).exists()) {
     PropertiesFile p = new PropertiesFile(fileName + ".properties");
     return p.returnMap();
   } else {
     throw new FileNotFoundException(fileName + ".properties was not found");
   }
 }
Example #2
0
 public boolean editPropertiesFile(String fileName, String type, String key, String value)
     throws FileNotFoundException {
   if ((new File(fileName + ".properties")).exists()) {
     PropertiesFile p = new PropertiesFile(fileName + ".properties");
     if (type.toLowerCase().equals("boolean")) {
       p.setBoolean(key, Boolean.valueOf(value.toString()));
     } else if (type.toLowerCase().equals("long")) {
       p.setLong(key, Long.valueOf(value.toString()));
     } else if (type.toLowerCase().equals("int")) {
       p.setInt(key, Integer.valueOf(value.toString()));
     } else if (type.toLowerCase().equals("string")) {
       p.setString(key, value.toString());
     } else if (type.toLowerCase().equals("double")) {
       p.setDouble(key, Double.valueOf(value.toString()));
     }
     p.save();
     return true;
   } else {
     throw new FileNotFoundException(fileName + ".properties was not found");
   }
 }