I know the general idea but I’m just not sure if it has an effect since the Android api states following: “Flushes this stream. Implementations of this method should ensure that any buffered data is written out. This implementation does nothing.”
This implementation does nothing <– does that mean its useless to do or am I missing something?
If you read extended docs on oracle
http://download.oracle.com/javase/1.4.2/docs/api/java/io/OutputStream.html#flush()
Means, the method itself does nothing, and it is abstract, so any underlying Class can implement its own version of flushing streams and forcing them to write (not waiting in write queue)
But anyway, as Guillaume pointed out, it’s good practice to call it anyway. If later on, you replace your stream with another implementation that does use it, then you’ll be sorry.
and
and from javadoc of
close(), just to note you don’t have to flush stream if you’re closing it immediately after.related:
FileOutputStream.close is really slow when writing large file
flush in java.io.FileWriter