Skip to content

Commit 7e58c97

Browse files
committed
Internal refactoring
1 parent fad33fc commit 7e58c97

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ public Builder() {
9191
// empty
9292
}
9393

94+
private byte[] checkOriginByteArray() throws IOException {
95+
return checkOrigin().getByteArray();
96+
}
97+
9498
/**
9599
* Builds a new {@link UnsynchronizedByteArrayInputStream}.
96100
* <p>
@@ -114,7 +118,7 @@ public Builder() {
114118
*/
115119
@Override
116120
public UnsynchronizedByteArrayInputStream get() throws IOException {
117-
return new UnsynchronizedByteArrayInputStream(checkOrigin().getByteArray(), offset, length);
121+
return new UnsynchronizedByteArrayInputStream(this);
118122
}
119123

120124
@Override
@@ -201,6 +205,10 @@ private static int requireNonNegative(final int value, final String name) {
201205
*/
202206
private int markedOffset;
203207

208+
private UnsynchronizedByteArrayInputStream(final Builder builder) throws IOException {
209+
this(builder.checkOriginByteArray(), builder.offset, builder.length);
210+
}
211+
204212
/**
205213
* Constructs a new byte array input stream.
206214
*

0 commit comments

Comments
 (0)