how to write to a secific line in a file

How can I write to a particular line or area in a text file. Right now I can only keep adding to it, but I want to be able to edit it and go back and write over some text.
[178 byte] By [jkhoaa] at [2007-11-26 13:46:34]
# 1
Use RandomAccessFile, you can move forward and backwards. http://java.sun.com/j2se/1.5.0/docs/api/java/io/RandomAccessFile.html
AjaySingh516a at 2007-7-8 1:21:50 > top of Java-index,Java Essentials,New To Java...
# 2
Note that RandomAccessFile will only help if you are replacing exactly the same length. If not and the file is truely sequential then you will have to read the entire file and write it while replacing the section that you want.
jschella at 2007-7-8 1:21:50 > top of Java-index,Java Essentials,New To Java...