官方的解释:注意红色的部分
close
public void close()
throws IOException
Description copied from class: Writer
Closes the stream, flushing it first. Once the stream has been closed, further write() or flush() invocations will cause an IOException to be thrown. Closing a previously closed stream has no effect.
Specified by:
close in interface Closeable
Specified by:
close in interface AutoCloseable
Specified by:
close in class Writer
Throws:
IOException - If an I/O error occurs 作者: 朱宏青 时间: 2012-11-3 21:49
记得以前学io流的时候好像说过,越高层的类,管理着底层的类。类似接管的关系,具体不是很清楚。
在我理解就是,file给了bw一个指向而已,之后的事就不用file操心了,bw会解决一切。