Is it necessary to close each nested OutputStream and Writer separately?

后端 未结 7 2033
醉酒成梦
醉酒成梦 2020-11-28 02:28

I am writing a piece of code:

OutputStream outputStream = new FileOutputStream(createdFile);
GZIPOutputStream gzipOutputStream = new GZIPOutputStream(outputS         


        
相关标签:
7条回答
  • 2020-11-28 03:20

    It will be fine if you only close the last stream - the close call will be send to the underlying streams, too.

    0 讨论(0)
提交回复
热议问题