7
是否需要分别关闭每个嵌套的OutputStream和Writer?
我正在写一段代码: OutputStream outputStream = new FileOutputStream(createdFile); GZIPOutputStream gzipOutputStream = new GZIPOutputStream(outputStream); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(gzipOutputStream)); 我是否需要关闭每个流或作家,如下所示? gzipOutputStream.close(); bw.close(); outputStream.close(); 还是只关闭最后一条流会好吗? bw.close();