Closes this stream. This implementation closes the target stream. @throws IOException if an error occurs attempting to close this stream.
()
| 55 | * if an error occurs attempting to close this stream. |
| 56 | */ |
| 57 | @Override |
| 58 | public void close() throws IOException { |
| 59 | Throwable thrown = null; |
| 60 | try { |
| 61 | flush(); |
| 62 | } catch (Throwable e) { |
| 63 | thrown = e; |
| 64 | } |
| 65 | |
| 66 | try { |
| 67 | out.close(); |
| 68 | } catch (Throwable e) { |
| 69 | if (thrown == null) { |
| 70 | thrown = e; |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | if (thrown != null) { |
| 75 | SneakyThrow.sneakyThrow(thrown); |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * Ensures that all pending data is sent out to the target stream. This |
nothing calls this directly
no test coverage detected