Skip to content

Commit 9db6ef0

Browse files
committed
Internal refactoring
1 parent 60095a4 commit 9db6ef0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/main/java/org/apache/commons/io/output/WriterOutputStream.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public Builder() {
137137
*/
138138
@Override
139139
public WriterOutputStream get() throws IOException {
140-
return new WriterOutputStream(getWriter(), charsetDecoder, getBufferSize(), writeImmediately);
140+
return new WriterOutputStream(this);
141141
}
142142

143143
@Override
@@ -245,6 +245,11 @@ private static void checkIbmJdkWithBrokenUTF16(final Charset charset) {
245245
*/
246246
private final CharBuffer decoderOut;
247247

248+
@SuppressWarnings("resource") // caller closes.
249+
private WriterOutputStream(final Builder builder) throws IOException {
250+
this(builder.getWriter(), builder.charsetDecoder, builder.getBufferSize(), builder.writeImmediately);
251+
}
252+
248253
/**
249254
* Constructs a new {@link WriterOutputStream} that uses the virtual machine's {@link Charset#defaultCharset() default charset} and with a default output
250255
* buffer size of {@value #BUFFER_SIZE} characters. The output buffer will only be flushed when it overflows or when {@link #flush()} or {@link #close()} is

0 commit comments

Comments
 (0)