title: Write to file at particular index
body: <p>I need to write to a file at a particular index position. <code>BufferedWriter</code> and <code>PrintWriter</code> does not allow writing to an index. How do I go about achieving this? </p>
  
  <p>Basically what i want to do is if a file contains an empty line at the EOF then i need to write at that position, else insert a new line and write. Copying the contents of the file to a temporary file and then deleting the original file and then again renaming the temporary file to the original file's name isn't an option.</p>
  
  <p>Thanks</p>