Java Utililty Methods Properties Save

List of utility methods to do Properties Save

Description

The list of methods to do Properties Save are organized into topic(s).

Method

voidsaveProperties(Map map, Writer tmpWriter)
save Properties
BufferedWriter writer = new BufferedWriter(tmpWriter);
try {
    for (Entry<String, String> e : map.entrySet()) {
        writer.append(e.getKey());
        writer.append('=');
        writer.append(e.getValue());
        writer.append('\n');
} finally {
    writer.close();
voidsaveProperties(Properties p, String file)
save Properties
FileOutputStream fos = null;
try {
    fos = new FileOutputStream(new File(file));
    p.store(fos, "User saved");
} catch (Exception e) {
    e.printStackTrace();
if (fos != null) {
...
voidsaveProperties(Properties p, String sFile)
Menyimpan file properties ke file
try {
    FileOutputStream out = new FileOutputStream(sFile);
    p.store(out, "Ini baris komentar\nFile Konfigurasi");
    System.out.println("File konfigurasi disimpan.....");
    out.close();
} catch (IOException ex) {
    System.out.println(ex.getMessage());
booleansaveProperties(Properties prop, String fileName, String remark)
save Properties
OutputStream fos;
try {
    fos = new FileOutputStream(fileName);
    prop.store(fos, remark);
} catch (FileNotFoundException e) {
    return false;
} catch (IOException e) {
    return false;
...
voidsaveProperties(Properties properties, File file)
Saves properties to a file.
FileOutputStream out = new FileOutputStream(file);
try {
    properties.store(out, "Modifications you make to this file may be overriden by Prudence!");
} finally {
    out.close();
voidsaveProperties(Properties properties, File propertiesFile, String comments)
Save data from a Properties object into some .properties file
if (!(propertiesFile.exists() && propertiesFile.isFile())) {
    propertiesFile.createNewFile();
try (OutputStream out = new FileOutputStream(propertiesFile)) {
    properties.store(out, comments);
voidsaveProperties(Properties properties, File propertyFile)
save Properties
try {
    FileOutputStream propertiesFileOutputStream = new FileOutputStream(propertyFile);
    try {
        properties.store(propertiesFileOutputStream, null);
    } finally {
        propertiesFileOutputStream.close();
} catch (IOException e) {
...
voidsaveProperties(Properties properties, File propFile, String propertiesName)
Stores a Properties object on a persistent File
if (propFile.exists()) {
    propFile.delete();
FileOutputStream fileOutputStream = null;
try {
    fileOutputStream = new FileOutputStream(propFile);
    properties.store(fileOutputStream, propertiesName + " properties file");
} catch (IOException e) {
...
voidsaveProperties(Properties properties, String fileName, String header)
save Properties
File file = new File(SETTINGS_DIR + fileName);
try {
    BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(file));
    properties.store(outputStream, header);
} catch (IOException e) {
    e.printStackTrace();
voidsaveProperties(Properties properties, String filePath)
Methode d'enregistrement des proprietes dans un fichier
if (properties == null)
    throw new RuntimeException(
            "Erreur lors de l'ecriture du fichier de proprietes: La liste des proprietes est nulle");
if (filePath == null || filePath.trim().isEmpty())
    throw new RuntimeException(
            "Erreur lors de l'ecriture du fichier de proprietes: Le chemin du fichier n'est pas renseigne");
String completeFilePath = filePath.trim();
File file = new File(completeFilePath);
...