I want to “overwrite” what’s in the input file and replace it with the updated information.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you can read the whole text file, then close it, do so – then use
FileOutputStreamwrapped in anOutputStreamWriter, (FileOutputStreamwill overwrite by default).If you need to read and write at the same time, you should write to a different file, then delete the “old” file and rename the “new” file into place.