Hello .. i am using PrintWriter for writing some data in a file.
Now problem is that , if at some time application is stopped , while restarting , it starts writing in file from starting. (It rewrites)
Is there any solution for this ?
Hello .. i am using PrintWriter for writing some data in a file.
Now problem is that , if at some time application is stopped , while restarting , it starts writing in file from starting. (It rewrites)
Is there any solution for this ?
Your PrintWriter must be wrapped around a FileWriter or a FileOutputStream now; the last two classes have constructors that make them append to any already present content of a file. Read their API documentation.
right, the api documentation about FileWriter constructor parameters is saying
Code:
Parameters:
fileName - String The system-dependent filename.
append - boolean if true, then data will be written to the end of the file rather than the beginning.