- void flushBuffer() throws IOException {
- synchronized (lock) {
- ensureOpen();
- if (nextChar == 0)
- return;
- out.write(cb, 0, nextChar);
- nextChar = 0;
- }
- }
复制代码
我想说我看到的flushBuffer()源码是这个样子的,ensureOpen的作用就是判断writer是否关闭,ensureOpen()的源码如下:
- /** Checks to make sure that the stream has not been closed */
- private void ensureOpen() throws IOException {
- if (out == null)
- throw new IOException("Stream closed");
- }
复制代码
所以这里throw了异常需要自己去处理吧?难道我JDK1.7的原因???我就是看了一下源码,没仔细看。 |