Skip to content

Commit 63a32f3

Browse files
committed
Pass the class' builder internally
1 parent dbba1ff commit 63a32f3

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import java.io.OutputStream;
2323
import java.io.RandomAccessFile;
2424
import java.nio.file.StandardOpenOption;
25-
import java.util.Objects;
2625

2726
import org.apache.commons.io.build.AbstractOrigin;
2827
import org.apache.commons.io.build.AbstractStreamBuilder;
@@ -85,10 +84,9 @@ private Builder() {
8584
* @see AbstractOrigin#getFile()
8685
* @see #getUnchecked()
8786
*/
88-
@SuppressWarnings("resource") // caller closes
8987
@Override
9088
public RandomAccessFileOutputStream get() throws IOException {
91-
return new RandomAccessFileOutputStream(getRandomAccessFile());
89+
return new RandomAccessFileOutputStream(this);
9290
}
9391

9492
}
@@ -104,8 +102,8 @@ public static Builder builder() {
104102

105103
private final RandomAccessFile randomAccessFile;
106104

107-
private RandomAccessFileOutputStream(final RandomAccessFile randomAccessFile) {
108-
this.randomAccessFile = Objects.requireNonNull(randomAccessFile);
105+
private RandomAccessFileOutputStream(final Builder builder) throws IOException {
106+
this.randomAccessFile = builder.getRandomAccessFile();
109107
}
110108

111109
@Override

0 commit comments

Comments
 (0)