public static void saveProperty(String key, String value){ Properties properties = new Properties(); String file = ... try { if(new File(file).exists()){ properties.load(new FileInputStream(file)); } properties.put(key, value); properties.store(new FileOutputStream(file), null); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } public static String loadProperty(String key){ Properties properties = new Properties(); String file = ... try { properties.load(new FileInputStream(file)); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return (String)properties.get(key); }
댓글
댓글 쓰기