Can somebody fix it?
package pl.codegym.task.task20.task2003;
import java.io.*;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
/*
Wprowadzenie do properties
*/
public class Solution {
public static Map<String, String> properties = new HashMap<>();
public void fillInPropertiesMap() throws Exception {
// Implementuj tę metodę
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String file = reader.readLine();
reader.close();
FileInputStream fileInputStream = new FileInputStream(file);
load(fileInputStream);
}
public void save(OutputStream outputStream) throws Exception {
// Implementuj tę metodę
PrintWriter writer = new PrintWriter(outputStream);
for (Map.Entry<String, String> proper : properties.entrySet()) {
writer.println(proper.getKey() + " = " + proper.getValue());
}
writer.close();
}
public void load(InputStream inputStream) throws Exception {
// Implementuj tę metodę
Properties proper = new Properties();
proper.load(inputStream);
for(Map.Entry<Object, Object> para : proper.entrySet()){
String Key = String.valueOf(para.getKey());
String Value = String.valueOf(para.getValue());
properties.put(Key,Value);
}
inputStream.close();
}
public static void main(String[] args) throws IOException {
}
}
/*
Wprowadzenie do properties
W metodzie fillInPropertiesMap odczytaj nazwę pliku z konsoli i wypełnij mapę properties danymi z pliku.
Na temat .properties możesz przeczytać tutaj: http://en.wikipedia.org/wiki/.properties
Zaimplementuj logikę dla pliku IO dla klasy CodeGym.
Requirements:
1. Metoda fillInPropertiesMap musi odczytywać dane z konsoli.
2. Metoda fillInPropertiesMap musi tworzyć FileInputStream, przekazując odczytany ciąg jako argument.
3. Metoda fillInPropertiesMap powinna wywoływać metodę load, przekazując jako argument nowo utworzony FileInputStream.
4. Metoda save musi przechowywać mapę properties w obiekcie OutputStream przekazywanym jako argument.
5. Metoda load musi przywracać stan mapy properties z obiektu InputStream przekazywanego jako argument.
*/