File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Delete text when using RandomAccessFile Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Delete text when using RandomAccessFile" Watch "Delete text when using RandomAccessFile" New topic

Delete text when using RandomAccessFile

Panihari Mehta

Joined: Jun 10, 2002
Posts: 1
Dear Ranchers,
Is there any way to delete text in the middle of a file using RandomAccessFile ? I am making the end user modify the contents of a Properties file and then append the modifed contents to the end of the file.
Here i wish to delete the original contents before i append the modified content to the end of the file.
Any ideas,pls suggest,
Thanks in advance,
Panihari :roll:
Andrew Spruce

Joined: Feb 27, 2001
Posts: 21
Were you aware that there is a Properties class in the standard libraries with correspoding load() and store() methods to write to and read from an OutputStream/InputStream.
This would probably be cleaner than trying it yourself
I agree. Here's the link:
subject: Delete text when using RandomAccessFile
It's not a secret anymore!