Skip to content

Commit fad33fc

Browse files
committed
Internal refactoring
1 parent 71c9fe3 commit fad33fc

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/main/java/org/apache/commons/io/input/ReaderInputStream.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public Builder() {
143143
*/
144144
@Override
145145
public ReaderInputStream get() throws IOException {
146-
return new ReaderInputStream(getReader(), charsetEncoder, getBufferSize());
146+
return new ReaderInputStream(this);
147147
}
148148

149149
CharsetEncoder getCharsetEncoder() {
@@ -220,6 +220,11 @@ private static CharsetEncoder newEncoder(final Charset charset) {
220220

221221
private boolean endOfInput;
222222

223+
@SuppressWarnings("resource") // caller closes.
224+
private ReaderInputStream(final Builder builder) throws IOException {
225+
this(builder.getReader(), builder.charsetEncoder, builder.getBufferSize());
226+
}
227+
223228
/**
224229
* Constructs a new {@link ReaderInputStream} that uses the virtual machine's {@link Charset#defaultCharset() default charset} with a default input buffer
225230
* size of {@value IOUtils#DEFAULT_BUFFER_SIZE} characters.

0 commit comments

Comments
 (0)