From 099e3500a7357ee556aaad819e06e7180ec29db0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 10 Apr 2013 22:31:29 +0200 Subject: [PATCH] Expose the current rate over the maximum lifetime. --- .../xdcc/util/io/BandwidthCountingInputStream.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/net/pterodactylus/xdcc/util/io/BandwidthCountingInputStream.java b/src/main/java/net/pterodactylus/xdcc/util/io/BandwidthCountingInputStream.java index 5009cda..444512f 100644 --- a/src/main/java/net/pterodactylus/xdcc/util/io/BandwidthCountingInputStream.java +++ b/src/main/java/net/pterodactylus/xdcc/util/io/BandwidthCountingInputStream.java @@ -64,6 +64,16 @@ public class BandwidthCountingInputStream extends FilterInputStream { // /** + * Returns the current rate of this input stream, averaged over the maximum + * lifetime of the counter data. + * + * @return The current rate of this input stream, in bytes/second + */ + public long getCurrentRate() { + return accumulatingDataCounter.getCurrentRate(); + } + + /** * Returns the current rate of this input stream, averaged over the given * amount of milliseconds. * -- 2.7.4