Possible Duplicate:
How to append data to a file?
Quick question here, how can I update an exist file in java? when I open the file like this:
try {
File inFile = new File("scores.txt");
BufferedReader br = new BufferedReader(new InputStreamReader(
new FileInputStream(inFile)));
all the former content of the file is deleted. but I dont want it to be deleted because I need this information. thanks alot.
(In the absence of the actual code that writes and based on the use of
FileInputStream)Use one of the two argument constructors of
FileOutputStreamwho’s second argument is abooleanindicating if the file should be appended to, rather that overwritten: