This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes I/O and Streams and the fly likes Erase a line in a file and insert a new line onn that line. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Erase a line in a file and insert a new line onn that line." Watch "Erase a line in a file and insert a new line onn that line." New topic
Author

Erase a line in a file and insert a new line onn that line.

Minseong Kim
Greenhorn

Joined: Jun 28, 2010
Posts: 5
hi.

how can I search and erase a line in a file by using Java codes?

for example, if have README,

and I want to erase line 23 and insert new information, how am I able to do this using Java codes?

Thanks.
Tom Reilly
Rancher

Joined: Jun 01, 2010
Posts: 618
See this FAQ: Edit An Existing File http://faq.javaranch.com/java/EditAnExistingFile

Also see this post that points to the Java classes that you will use: http://www.coderanch.com/t/279094/Streams/java/Delete-line-text-file#1283566
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Erase a line in a file and insert a new line onn that line.
 
Similar Threads
How to access VSS through Java Code??
Huge Tree Manipulation
inserting text at some place in file
How to create a package?
how to add jar files to applet's classpath