There are many posts about this but I couldn't find one working correctly For Example below code works but it deletes the first line.
I want to insert some text at the beginning of a file without deleting anything, just an insert. Is that possible?
RandomAccessFile f = new RandomAccessFile(new File("myFile.txt"), "rw");
f.seek(0);
f.write("Blah Blah This is first line".getBytes());
f.close();
I also tried this, still deletes the first 12 bytes