我想將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