Hi , I would like to know how to get data from textfile to hashes .
now i have a textfile which looks like this
now i want fetch the data from this file in a hash but keys are going to name,id,address and values are going to be jhon,102100,linnoituksentie 10 so that mean i need to sperate the keys and values from the textfile then put the keys and values in hash , write now i can print the whole file on screen . so the code i have now is
now i have a textfile which looks like this
Code:
name=>Jhon
id=>102100
address=>linnoituksentie 10
now i want fetch the data from this file in a hash but keys are going to name,id,address and values are going to be jhon,102100,linnoituksentie 10 so that mean i need to sperate the keys and values from the textfile then put the keys and values in hash , write now i can print the whole file on screen . so the code i have now is
Code:
try { FileReader file = new FileReader ("c://INSTLOG.TXT");
BufferedReader buff = new BufferedReader (file);
boolean eof = false;
int a = 0;
while (!eof) {
String Inp = buff.readLine();
a++;
if (Inp == null)
eof = true;
else
System.out.println(Inp);
}
buff.close();
}
catch (IOException e) {
System.out.println ("Error ...." + e.toString());
}
}