Hello Guys, Hope youre all well :) Please can someone kindly tell me how I can write to a specific line. The value to be written needs to be in long and not as a string. The File is as follows:
1324214082786
1313131
Paid
0.0
the seconds line is time in miliseconds, i need to replace that to current miliseconds using filewriter. please tell me how and ive included the listener method to which this needs to be done.i m not experiencing error but it replaces whole file with a string.
/*********************Pay Button Listener***************************************/
public class payListener implements ActionListener{
public void actionPerformed(ActionEvent e) {
String fileName2 = "Ticket/"+ticketIDNumber+".dat";
File ticket2 = new File(fileName2);
if(ticket2.exists()){
try{
FileReader fileReader = new FileReader(fileName2);
BufferedReader bufferedReader = new BufferedReader(fileReader);
bufferedReader.readLine(); //OMIT Entrance Time
FileWriter fw = new FileWriter(fileName2);
BufferedWriter bufferedWriter = new BufferedWriter(fw);
//fw.write("Hello");
bufferedReader.close();
fileReader.close();
fw.close();
}
catch(IOException f){
System.out.println("Error in Setting Payment Time for ticket");
}
}
}
}
/*********************Pay Button Listener***************************************/