Tag: writer

是否有必要分别closures每个嵌套的OutputStream和Writer?

我正在写一段代码: OutputStream outputStream = new FileOutputStream(createdFile); GZIPOutputStream gzipOutputStream = new GZIPOutputStream(outputStream); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(gzipOutputStream)); 我是否需要closures每个stream或作者如下? gzipOutputStream.close(); bw.close(); outputStream.close(); 或者只是closures最后一个stream是好的? bw.close();