package com.javarush.task.task20.task2003;
import java.io.*;
import java.util.*;
/* ÐнакомÑÑво Ñ properties
РмеÑоде fillInPropertiesMap ÑÑиÑайÑе Ð¸Ð¼Ñ Ñайла Ñ ÐºÐ¾Ð½Ñоли и заполниÑе каÑÑÑ properties даннÑми из Ñайла.
ÐÑо .properties поÑиÑаÑÑ ÑÑÑ - http://ru.wikipedia.org/wiki/.properties
РеализÑйÑе Ð»Ð¾Ð³Ð¸ÐºÑ Ð·Ð°Ð¿Ð¸Ñи в Ñайл и ÑÑÐµÐ½Ð¸Ñ Ð¸Ð· Ñайла Ð´Ð»Ñ ÐºÐ°ÑÑÑ properties.
*/
public class Solution {
public static Map properties = new HashMap<>();
public static void main(String[] args) throws Exception {
Solution solution = new Solution();
solution.fillInPropertiesMap();
}
public void fillInPropertiesMap() throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String name = reader.readLine();
FileInputStream inputStream = new FileInputStream(name);
load(inputStream);
OutputStream outputStream = new FileOutputStream(name);
save(outputStream);
inputStream.close();
outputStream.close();
reader.close();
}
public void save(OutputStream outputStream) throws Exception {
Properties props = new Properties();
for (Map.Entry entry : properties.entrySet()) props.setProperty(entry.getKey(), entry.getValue()); //наполнÑем маÑÑив Properties паÑами клÑÑ-знаÑение
props.store(outputStream, null); //вÑгÑÑжаем паÑÑ Ð¼Ð°ÑÑива Properties в Ñайл .properties
}
public void load(InputStream inputStream) throws Exception {
Properties props = new Properties();
props.load(inputStream); //вÑгÑÑжаем Properties из Ñайла .properties в маÑÑив
for (Map.Entry