Skip to content

Commit 71c9fe3

Browse files
committed
Internal refactoring
1 parent 28fad63 commit 71c9fe3

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ public Builder() {
102102
*/
103103
@Override
104104
public ReadAheadInputStream get() throws IOException {
105-
return new ReadAheadInputStream(getInputStream(), getBufferSize(), executorService != null ? executorService : newExecutorService(),
106-
executorService == null);
105+
return new ReadAheadInputStream(this);
107106
}
108107

109108
/**
@@ -196,6 +195,12 @@ private static ExecutorService newExecutorService() {
196195

197196
private final Condition asyncReadComplete = stateChangeLock.newCondition();
198197

198+
@SuppressWarnings("resource")
199+
private ReadAheadInputStream(final Builder builder) throws IOException {
200+
this(builder.getInputStream(), builder.getBufferSize(), builder.executorService != null ? builder.executorService : newExecutorService(),
201+
builder.executorService == null);
202+
}
203+
199204
/**
200205
* Constructs an instance with the specified buffer size and read-ahead threshold
201206
*

0 commit comments

Comments
 (0)