Java Properties Save saveProperties(Properties properties, String propertiesFileName, String header)

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

Description

Save properties to a specified file.

License

Open Source License

Parameter

Parameter Description
properties Properties collection to save.
propertiesFileName Name of file to save to.
header Header line describing properties.

Exception

Parameter Description
IOException if properties file cannot be saved.

Declaration


public static void saveProperties(Properties properties, String propertiesFileName, String header)
        throws IOException 

Method Source Code


//package com.java2s;
/*   Please see the license information at the end of this file. */

import java.io.*;

import java.util.*;

public class Main {
    /**   Save properties to a specified file.
     *//from w ww .j a v a  2s .c  o  m
     *   @param   properties            Properties collection to save.
     *   @param   propertiesFileName      Name of file to save to.
     *   @param   header               Header line describing properties.
     *
     *   @throws   IOException if properties file cannot be saved.
     */

    public static void saveProperties(Properties properties, String propertiesFileName, String header)
            throws IOException {
        FileOutputStream propertiesFile = new FileOutputStream(propertiesFileName);

        properties.store(propertiesFile, header);

        propertiesFile.flush();
        propertiesFile.close();
    }
}

Related

  1. saveProperties(Properties properties, File propertiesFile, String comments)
  2. saveProperties(Properties properties, File propertyFile)
  3. saveProperties(Properties properties, File propFile, String propertiesName)
  4. saveProperties(Properties properties, String fileName, String header)
  5. saveProperties(Properties properties, String filePath)
  6. saveProperties(Properties props, File location)
  7. saveProperties(String fileName, Properties properties)
  8. saveProperties(String fileName, Properties properties, String title)
  9. saveProperties(String propName, Properties props)