Store and refresh saved file each time.

Hello,
I am writing program to save the inputs (String cmd) .I store it in seperate text file using FileOutputStream(filename).
My problem os i am not able to refresh the contents of file each time i press the button save.
I m use,
FileOutputStream o=new FileOutputStream(filename,true).
when i try to clear the saved text file,
I give, o.reset (filename);
but, it gives error.
I think o.reset() not define for FileOutputStream function.
what can I do.
how can I reset the text file(file.txt) each time.
I need each time the input is given, the file already strore must erased and store the new inputs.
thanks in advance.

Just write a new file, it will delete the existing data and overwrite it, unless you specified "append" in the constructor.

Similar Messages

Maybe you are looking for