I want to open a file and then read it line by line. In some lines I want to append a string to exactly this line. Is this possible?
I have a code for opening the file and reading it like the following:
File file = new File("MyFile.txt");
BufferedReader bufRdr = new BufferedReader(new FileReader(file));
String line = null;
try {
while((line = bufRdr.readLine()) != null)
{
// read line by line and append some string to the line
}
} catch (IOException e) {
// ...
}
but how can I append a string to the current line and write this to the file?