Skip to content

Commit

Permalink
[IO-860] Use a long instead of an int for
Browse files Browse the repository at this point in the history
ThrottledInputStream.Builder.setMaxBytes(long, ChronoUnit)
  • Loading branch information
garydgregory committed Nov 27, 2024
1 parent b522681 commit 024e4b6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/changes/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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.">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public ThrottledInputStream get() throws IOException {
* @throws IllegalArgumentException Thrown if maxBytesPerSecond &lt;= 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();
}
Expand All @@ -149,7 +149,7 @@ public Builder setMaxBytes(final int value, final ChronoUnit chronoUnit) {
* @throws IllegalArgumentException Thrown if maxBytesPerSecond &lt;= 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();
}
Expand Down

0 comments on commit 024e4b6

Please sign in to comment.