我想将base64编码的数据写入文件,实时解码。我有我必须关闭这些包装的Java I/O对象中的多少个?
BufferedWriter bw = new BufferedWriter(
new OutputStreamWriter(
new Base64OutputStream(
new FileOutputStream(myFile, false)));
我想这样的作品,在我finally
块我称之为bw.close()
- 那就是,close the outermost wrapper。这足够了,还是一些匿名中介对象会泄漏?
我试着翻看代码,但是我被卡在Sun的专有的OutputStreamWriter的编码处理程序的实现中。它也似乎没有在文档中明确阐述。
Dup:http://stackoverflow.com/questions/6586866/closing-nested-streams和:http://stackoverflow.com/questions/8080649/do-i-have-to-close-fileoutputstream- which-is-wrapped-by-printstream – sara
我不知道为什么我找不到那些。谢谢@sara! – Coderer