Appending data to already existing file.

I have to read a input java file and search for a particular word in that file.

As soon as i find the word i have to add a comment to the end of the particular line in the input java file.

anyone please tell me how to do this?

I have tried with append option but it is appending only at the end of the file,not at he desired line.

Please tell me what option i have to use to do this.

[414 byte] By [Connecting_java_to_Oraclea] at [2007-11-27 10:55:07]
# 1

Read a line and, if you find the word, append the comment. Write the line *.

Repeat until you are done.

[Edit] * Use a temporary file if need be and delete the original after you have done all the input and output.

pbrockway2a at 2007-7-29 11:54:21 > top of Java-index,Java Essentials,Java Programming...