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. @throws IOException if an error occurs while closing this writer.
()
| 92 | * if an error occurs while closing this writer. |
| 93 | */ |
| 94 | @Override |
| 95 | public void close() throws IOException { |
| 96 | synchronized (lock) { |
| 97 | if (isClosed()) { |
| 98 | return; |
| 99 | } |
| 100 | |
| 101 | Throwable thrown = null; |
| 102 | try { |
| 103 | flushInternal(); |
| 104 | } catch (Throwable e) { |
| 105 | thrown = e; |
| 106 | } |
| 107 | buf = null; |
| 108 | |
| 109 | try { |
| 110 | out.close(); |
| 111 | } catch (Throwable e) { |
| 112 | if (thrown == null) { |
| 113 | thrown = e; |
| 114 | } |
| 115 | } |
| 116 | out = null; |
| 117 | |
| 118 | if (thrown != null) { |
| 119 | SneakyThrow.sneakyThrow(thrown); |
| 120 | } |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | /** |
| 125 | * Flushes this writer. The contents of the buffer are committed to the |
nothing calls this directly
no test coverage detected