I have a file of 250 line. I wanted to insert some text after line 128.
I only found that I can append a text at the end of file like
try {
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("outfilename", true)));
out.println("the text");
out.close();
} catch (IOException e) {
//oh noes!
}
That is found on this post How to append text to an existing file in Java
But with no mention to the line number or sth.