Donno what is wrong!!
package com.codegym.task.task20.task2003;
import javax.print.attribute.ResolutionSyntax;
import java.io.*;
import java.util.*;
/*
Introducing properties
• The fillInPropertiesMap method must read data from the console.
• The fillInPropertiesMap method must create a FileInputStream, passing the read string as an argument.
• The fillInPropertiesMap method should call the load method, passing the newly created FileInputStream as an argument.
• The save method must store the properties map in the OutputStream object passed as an argument.
• The load method must restore the state of the properties map from the InputStream object passed as an argument.
*/
public class Solution {
public static Map<String, String> properties = new HashMap<>();
public void fillInPropertiesMap() throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));// Implement this method
String fileName = br.readLine();
FileInputStream fis = new FileInputStream(fileName);
load(fis);
}
public void save(OutputStream outputStream) throws Exception {
PrintWriter p = new PrintWriter(outputStream);// Implement this method
Properties properties = new Properties();
for (Map.Entry<Object, Object> map : properties.entrySet()){
properties.put(map.getKey(), map.getValue());
}
properties.store(p,null);
p.close();
}
public void load(InputStream inputStream) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(inputStream));// Implement this method
Properties prop = new Properties();
for (Map.Entry<String,String> map : properties.entrySet()){
String key = map.getKey();
//String value = map.getValue();
String eg = prop.getProperty(key);
System.out.println(eg);
}
prop.load(br);
br.close();
}
public static void main(String[] args) throws Exception {
Solution s = new Solution();
s.fillInPropertiesMap();
FileInputStream f = new FileInputStream("C:\\Users\\admin\\Downloads\\CodeGymTasks\\CodeGymTasks\\2.JavaCore\\src\\com\\codegym\\task\\task20\\task2003\\T.txt");
s.load(f);
f.close();
}
}