package de.codegym.task.task20.task2003;
import java.io.*;
import java.util.*;
/*
Eigenschaften
*/
public class Solution {
public static Map<String, String> properties = new HashMap<>();
public void fillInPropertiesMap() throws IOException {
// Implementiere diese Methode
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
File yourFile = new File(reader.readLine());
OutputStream outputStream = new FileOutputStream(yourFile);
InputStream inputStream = new FileInputStream(yourFile);
while(inputStream.available() > 0){
String text = yourFile.toString();
String[] string = text.split("\\s+");
properties.put(string[0], string[1]);
}
properties.save(outputStream);
outputStream.flush();
}
public void save(OutputStream outputStream) throws Exception {
// Implementiere diese Methode
PrintWriter pw = new PrintWriter(outputStream);
String exist = properties != null ? "ja" : "nein";
pw.println(exist);
for(Map.Entry<String, String> pair : properties.entrySet()){
pw.println(pair.getKey());
pw.println(pair.getValue());
}
pw.flush();
pw.close();
}
public void load(InputStream inputStream) throws Exception, IOException {
// Implementiere diese Methode
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
String exist = reader.readLine();
if(exist.equals("ja")){
while(reader.ready()){
String key = reader.readLine();
String value = reader.readLine();
properties.put(key, value);
}
}
reader.close();
}
public static void main(String[] args) {
}
}