You are wrapping your FileWriter
with a BufferedWriter
FileWriter fw = new FileWriter(file.getAbsoluteFile());
BufferedWriter bw = new BufferedWriter(fw);
but only closing the FileWriter
fw.close();
Since the FileWriter
doesn't have access and doesn't know about the BufferedWriter
, it won't flush any possible remaining buffer. You could either call flush()
on bw
or close bw
instead of fw
. Calling bw.close()
will take care of closing the wrapped FileWriter
.
bw.close();
in.close();