Here you can find the source of saveProps(String path, Properties props)
Parameter | Description |
---|---|
path | File path. |
props | Properties. |
public static boolean saveProps(String path, Properties props)
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.util.Properties; public class Main { /**/*from www. j av a 2s. c om*/ * Save properties to file. * @param path File path. * @param props Properties. * @return Success or not. */ public static boolean saveProps(String path, Properties props) { return saveProps(new File(path), props); } /** * Save properties to file. * @param file File * @param props Properties. * @return Success or not. */ public static boolean saveProps(File file, Properties props) { OutputStream out = null; try { out = new FileOutputStream(file); props.store(out, null); return true; } catch (Exception e) { return false; } finally { if (out != null) { try { out.close(); } catch (IOException e) { } } } } }