Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Minseong Kim
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic