title: Write to file at explicit line in android java
body: <p>I have an html file in android app public directory that is loaded into a <code>webView</code> with <code>loadData()</code> function. I did not place this html file in directory <code>/android_assets</code>because the file needs to be written to at runtime: <a href="https://stackoverflow.com/a/3760684/5620779">why cannot write to /android_assets at runtime</a></p>
  
  <p>I need to write to the file at runtime by inserting some html snippet at a precise location in the file.
  My question is: How to write to file at some line?
  I have read that it may not be safe: <a href="https://stackoverflow.com/a/2537991/5620779">Prepending to file in java</a></p>