@Override public void close() throws IOException {
synchronized (lock) {
    if (isClosed()) {
      return;
    }
    Throwable thrown=null;
    try {
      flushInternal();
    }
 catch (    Throwable e) {
      thrown=e;
    }
    buf=null;
    try {
      out.close();
    }
 catch (    Throwable e) {
      if (thrown == null) {
        thrown=e;
      }
    }
    out=null;
    if (thrown != null) {
      SneakyThrow.sneakyThrow(thrown);
    }
  }
}

@ Override public void close ( ) throws IOException { synchronized ( lock ) { if ( isClosed ( ) ) { return ; } Throwable thrown = null ; try { flushInternal ( ) ; } catch ( Throwable e ) { thrown = e ; } buf = null ; try { out . close ( ) ; } catch ( Throwable e ) { if ( thrown == null ) { thrown = e ; } } out = null ; if ( thrown != null ) { SneakyThrow . sneakyThrow ( thrown ) ; } } }
closes this writer . the contents of the buffer are flushed , the target writer is closed , and the buffer is released . only the first invocation of close has any effect .
