Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How do I edit a text file in Java?

807588Mar 22 2009 — edited Mar 22 2009
Hi everyone,

I'd like to open a text file and edit the text, that is to change and edit a text file, that already has been written, such as add text in the middle or at the begining of the text file.

I used RandomAccessFile class and seek method to work with text files, but I connot use it to add text to the middle of the file or to the begining of an already written text file.

Is there a way in Java to add text to the begining or the middle of a text file?

Thank you,
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 19 2009
Added on Mar 22 2009
7 comments
830 views