MCPcopy Create free account
hub / github.com/davidgiven/luje / close

Method close

lib/java/io/BufferedWriter.java:94–122  ·  view source on GitHub ↗

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.

()

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

isClosedMethod · 0.95
flushInternalMethod · 0.95
sneakyThrowMethod · 0.95
closeMethod · 0.65

Tested by

no test coverage detected