Skip to content

Commit 8218284

Browse files
authored
implement available. (Azure#27907)
1 parent d108c7d commit 8218284

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

common/perf-test-core/src/main/java/com/azure/perf/test/core/RepeatingInputStream.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
package com.azure.perf.test.core;
55

6+
import java.io.IOException;
67
import java.io.InputStream;
78
import java.util.Random;
89

@@ -84,5 +85,15 @@ public boolean markSupported() {
8485
public synchronized void reset() {
8586
this.pos = this.mark;
8687
}
88+
89+
@Override
90+
public int available() throws IOException {
91+
long remaining = this.size - this.pos;
92+
if (remaining > Integer.MAX_VALUE) {
93+
return Integer.MAX_VALUE;
94+
} else {
95+
return (int) remaining;
96+
}
97+
}
8798
}
8899

0 commit comments

Comments
 (0)