Java Properties Save saveProperties(Properties properties, File file)

Here you can find the source of saveProperties(Properties properties, File file)

Description

Saves properties to a file.

License

LGPL

Parameter

Parameter Description
properties The properties
file The file

Exception

Parameter Description
IOException In case of a writing error

Declaration

public static void saveProperties(Properties properties, File file) throws IOException 

Method Source Code

//package com.java2s;
/**/*  w w w .j  av  a  2  s.  c  om*/
 * Copyright 2009-2016 Three Crickets LLC.
 * <p>
 * The contents of this file are subject to the terms of the LGPL version 3.0:
 * http://www.gnu.org/copyleft/lesser.html
 * <p>
 * Alternatively, you can obtain a royalty free commercial license with less
 * limitations, transferable or non-transferable, directly from Three Crickets
 * at http://threecrickets.com/
 */

import java.io.File;

import java.io.FileOutputStream;
import java.io.IOException;

import java.util.Properties;

public class Main {
    /**
     * Saves properties to a file.
     * 
     * @param properties
     *        The properties
     * @param file
     *        The file
     * @throws IOException
     *         In case of a writing error
     */
    public static void saveProperties(Properties properties, File file) throws IOException {
        FileOutputStream out = new FileOutputStream(file);
        try {
            properties.store(out, "Modifications you make to this file may be overriden by Prudence!");
        } finally {
            out.close();
        }
    }
}

Related

  1. saveProperties(Map map, File file, String encoding)
  2. saveProperties(Map map, Writer tmpWriter)
  3. saveProperties(Properties p, String file)
  4. saveProperties(Properties p, String sFile)
  5. saveProperties(Properties prop, String fileName, String remark)
  6. saveProperties(Properties properties, File propertiesFile, String comments)
  7. saveProperties(Properties properties, File propertyFile)
  8. saveProperties(Properties properties, File propFile, String propertiesName)
  9. saveProperties(Properties properties, String fileName, String header)