以下是BufferedWriter.java 源码文件,
构造函数为
public BufferedWriter(Writer out)
{
this(out, defaultCharBufferSize);
}
public void close() throws IOException
{
synchronized (lock)
{
if (out == null)
{
return;
}
try
{
flushBuffer();
}
finally
{
out.close(); //fw = new FileWriter("bwDemo.txt")
// bw = new BufferedWriter(fw)u在关闭缓冲区bw.close();时,实际上也隐含有fw.close();方法!,这个你只需记住就行!
out = null;
cb = null;
}
}
}
|