I used OutputStreamWriter with socket. When I tried to write data, I found that the data was not sent out. So I tried the flush() and it succeeded.
I would like to ask some question:
- Do all output streams have a buffer ? So is there any unique benefit of a class like
BufferedOutputStream? (Since there are buffers) - when I use
close(). Has the data in the buffer disappeared or was flushed out? I tested it, the data in the buffer was not successfully written out. But I have seen in many places that calling theclose()will flush the data in the buffer?