In the below code I am trying to append some text to a file using FileOutputStream
and BufferedWriter
as shown below.At ru time, despite the file has some data, when i use FileOutputStream
and BufferedWriter
i found the file is empty and even the data i want to append bw.write("new information");
is not existing the file is completely empty.
Kindly please let me know how to fix it.
Code:
File f = new File(SystemConfig.getSystConfigInstance("E"));
System.out.println(f.getAbsolutePath() + " name: " + f.getName());
OutputStream os = new FileOutputStream(f);
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(os));
bw.write("new information");