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

Method close

lib/java/io/OutputStreamWriter.java:146–169  ·  view source on GitHub ↗

Closes this writer. This implementation flushes the buffer as well as the target stream. The target stream is then closed and the resources for the buffer and converter are released. Only the first invocation of this method has any effect. Subsequent calls do nothing. @throws IOException

()

Source from the content-addressed store, hash-verified

144 * if an error occurs while closing this writer.
145 */
146 @Override
147 public void close() throws IOException {
148 synchronized (lock) {
149 if (encoder != null) {
150 if (encoderFlush) {
151 CoderResult result = encoder.flush(bytes);
152 while (!result.isUnderflow()) {
153 if (result.isOverflow()) {
154 flush();
155 result = encoder.flush(bytes);
156 } else {
157 result.throwException();
158 }
159 }
160 }
161
162 flush();
163 out.flush();
164 out.close();
165 encoder = null;
166 bytes = null;
167 }
168 }
169 }
170
171 /**
172 * Flushes this writer. This implementation ensures that all buffered bytes

Callers

nothing calls this directly

Calls 6

isUnderflowMethod · 0.95
isOverflowMethod · 0.95
flushMethod · 0.95
throwExceptionMethod · 0.95
flushMethod · 0.65
closeMethod · 0.65

Tested by

no test coverage detected