Here you can find the source of saveProperties(Properties properties, String propertiesFileName, String header)
Parameter | Description |
---|---|
properties | Properties collection to save. |
propertiesFileName | Name of file to save to. |
header | Header line describing properties. |
Parameter | Description |
---|---|
IOException | if properties file cannot be saved. |
public static void saveProperties(Properties properties, String propertiesFileName, String header) throws IOException
//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(); } }