Java Properties Save saveProperties(String fileName, Properties properties)

Here you can find the source of saveProperties(String fileName, Properties properties)

Description

save Properties

License

Open Source License

Declaration

public static boolean saveProperties(String fileName, Properties properties) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Properties;

public class Main {
    public static boolean saveProperties(String fileName, Properties properties) {
        FileOutputStream fos = null;
        try {//from w  w w . j a va  2 s.  co  m
            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");
        } finally {
            try {
                fos.close();
            } catch (IOException ex) {
                //Logger.getLogger(AppVirClientConfigJFrame.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
        return false;
    }
}

Related

  1. saveProperties(Properties properties, File propFile, String propertiesName)
  2. saveProperties(Properties properties, String fileName, String header)
  3. saveProperties(Properties properties, String filePath)
  4. saveProperties(Properties properties, String propertiesFileName, String header)
  5. saveProperties(Properties props, File location)
  6. saveProperties(String fileName, Properties properties, String title)
  7. saveProperties(String propName, Properties props)
  8. savePropertiesToEncodedString(Properties props, String comment)
  9. savePropertiesToString(Properties props, String comment)