This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Well you have several choices. You can read in the file, one line at a time, and write it to a temp file, and at the correct time shove your own line in there. When finished reading in the original file, write the temp file back out to it. You could read in input file into an array, and do an insert at the correct place. This could be the beginning of an Editor of some sort if you stuck on a GUI. If the text file is small enough, you could read it into one giant string. Then sub-string the part before the addition, add in your stuff, and concatenate in the last part of the string.
"JavaRanch, where the deer and the Certified play" - David O'Meara