List of utility methods to do Properties Save
void | saveProperties(Properties properties, String propertiesFileName, String header) Save properties to a specified file. FileOutputStream propertiesFile = new FileOutputStream(propertiesFileName);
properties.store(propertiesFile, header);
propertiesFile.flush();
propertiesFile.close();
|
void | saveProperties(Properties props, File location) Save a Properties object to a path. PrintStream os = new PrintStream(new FileOutputStream(location.getAbsolutePath())); List<String> keys = new ArrayList<>(props.stringPropertyNames()); Collections.sort(keys); for (Object key : keys) { os.println(key.toString() + " = " + props.get(key).toString()); os.close(); |
boolean | saveProperties(String fileName, Properties properties) save Properties FileOutputStream fos = null; try { fos = new FileOutputStream(fileName); properties.store(fos, null); } catch (FileNotFoundException ex) { System.out.println("The server configuration properties file not exists"); } catch (IOException ioe) { System.out.println("The property file configuration wrintng error"); ... |
void | saveProperties(String fileName, Properties properties, String title) save Properties try { FileOutputStream fos = new FileOutputStream(makeFullPathname(fileName)); BufferedOutputStream bos = new BufferedOutputStream(fos); properties.store(bos, title); bos.close(); fos.close(); } catch (IOException e) { e.printStackTrace(); ... |
void | saveProperties(String propName, Properties props) save a properties file try { FileOutputStream fs = new FileOutputStream(propName); props.store(fs, null); } catch (RuntimeException ex) throw ex; } catch (IOException ex) throw new IllegalArgumentException("Cannot save properties to " + propName); |
String | savePropertiesToEncodedString(Properties props, String comment) save Properties To Encoded String if (props == null) return null; return encodeName(savePropertiesToString(props, comment)); |
String | savePropertiesToString(Properties props, String comment) save Properties To String if (props == null) return null; ByteArrayOutputStream out = new ByteArrayOutputStream(); props.store(out, comment); String tmpString = out.toString(); out = null; return tmpString; |
void | saveProperty(String key, String value) save Property if (mProperties == null) mProperties = new Properties(); createFile(); try (OutputStream lOutputStream = new FileOutputStream(FILE_NAME)) { mProperties.put(key, value); mProperties.store(lOutputStream, null); } catch (IOException e) { throw e; ... |
void | saveProperty(String key, String value) save Property Properties prop = getProperties(); OutputStream output = null; try { output = new FileOutputStream("config.properties"); prop.setProperty(key, value); prop.store(output, null); } catch (IOException io) { io.printStackTrace(); ... |
void | saveProperty(String key, String value) save Property Properties properties = loadUserSettings(); properties.setProperty(key, value); saveUserSettings(properties); |