file io - In Java, when I call OutputStream.close() do I always need to call OutputStream.flush() before? -
if call close()
in output stream, output guaranteed, or need call flush()
always?
close() flushes no need call.
edit: answer based on common sense , outputstream encountered. going implement close() buffered stream without flushing buffer first? there no harm call flush right before close(). however, there consequences if flush() called excessively. may defeat underneath buffering mechanism.
Comments
Post a Comment