This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-io.git
The following commit(s) were added to refs/heads/master by this push:
new 024e4b645 [IO-860] Use a long instead of an int for
ThrottledInputStream.Builder.setMaxBytes(long, ChronoUnit)
024e4b645 is described below
commit 024e4b645d73622d8aa1881931b2b0a6618aec16
Author: Gary Gregory <[email protected]>
AuthorDate: Wed Nov 27 08:37:43 2024 -0500
[IO-860] Use a long instead of an int for
ThrottledInputStream.Builder.setMaxBytes(long, ChronoUnit)
---
src/changes/changes.xml | 2 +-
src/main/java/org/apache/commons/io/input/ThrottledInputStream.java | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 03e6bb16c..fb4e0f4a5 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -49,7 +49,7 @@ The <action> type attribute can be add,update,fix,remove.
<release version="2.19.0" date="YYYY-MM-DD" description="Version 2.18.1:
Java 8 is required.">
<!-- FIX -->
<!-- ADD -->
- <action dev="ggregory" type="add" issue="IO-860" due-to="Nico Strecker,
Gary Gregory">Add ThrottledInputStream.Builder.setMaxBytes(int,
ChronoUnit).</action>
+ <action dev="ggregory" type="add" issue="IO-860" due-to="Nico Strecker,
Gary Gregory">Add ThrottledInputStream.Builder.setMaxBytes(long,
ChronoUnit).</action>
<!-- UPDATE -->
</release>
<release version="2.18.0" date="2024-11-16" description="Version 2.18.0:
Java 8 is required.">
diff --git
a/src/main/java/org/apache/commons/io/input/ThrottledInputStream.java
b/src/main/java/org/apache/commons/io/input/ThrottledInputStream.java
index 575fa99e6..28770e161 100644
--- a/src/main/java/org/apache/commons/io/input/ThrottledInputStream.java
+++ b/src/main/java/org/apache/commons/io/input/ThrottledInputStream.java
@@ -126,7 +126,7 @@ public final class ThrottledInputStream extends
CountingInputStream {
* @throws IllegalArgumentException Thrown if maxBytesPerSecond <=
0.
* @since 2.19.0
*/
- public Builder setMaxBytes(final int value, final ChronoUnit
chronoUnit) {
+ public Builder setMaxBytes(final long value, final ChronoUnit
chronoUnit) {
setMaxBytes(value, chronoUnit.getDuration());
return asThis();
}
@@ -149,7 +149,7 @@ public final class ThrottledInputStream extends
CountingInputStream {
* @throws IllegalArgumentException Thrown if maxBytesPerSecond <=
0.
*/
// Consider making public in the future
- Builder setMaxBytes(final int value, final Duration duration) {
+ Builder setMaxBytes(final long value, final Duration duration) {
setMaxBytesPerSecond((double) Objects.requireNonNull(duration,
"duration").toMillis() / 1_000 * value);
return asThis();
}