title: How to append a new line to beginning of an existing file in java?
body: <p>Assuming I have a txt file located in /mypath/sampletext.txt. How do I append a new line to the beginning of the file with the following in Java while preserving the original text file's contents?:</p>
  
  <pre><code>String startStr ="--Start of File--";
  </code></pre>
  
  <p>Looking for a way to do this without having to create an intermediary 2nd file and make modifications only to the existing file if possible.</p>