From 57737deafd02c03fcea5c3a3465d910338558f29 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Mon, 27 May 2013 22:15:55 +0200 Subject: [PATCH] =?utf8?q?Count=20and=20expose=20the=20number=20of=20bytes?= =?utf8?q?=20that=20have=20been=20read=20from=20the=20connection=E2=80=99s?= =?utf8?q?=20source.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../java/net/pterodactylus/sonitus/data/Pipeline.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/main/java/net/pterodactylus/sonitus/data/Pipeline.java b/src/main/java/net/pterodactylus/sonitus/data/Pipeline.java index a38d6fe..4409151 100644 --- a/src/main/java/net/pterodactylus/sonitus/data/Pipeline.java +++ b/src/main/java/net/pterodactylus/sonitus/data/Pipeline.java @@ -260,6 +260,9 @@ public class Pipeline implements Iterable { /** The executor service. */ private final ExecutorService executorService; + /** The number of copied bytes. */ + private long counter; + /** * Creates a new connection. * @@ -279,6 +282,20 @@ public class Pipeline implements Iterable { } // + // ACCESSORS + // + + /** + * Returns the number of bytes that this connection has received from its + * source during its lifetime. + * + * @return The number of processed input bytes + */ + public long counter() { + return counter; + } + + // // ACTIONS // @@ -333,6 +350,7 @@ public class Pipeline implements Iterable { for (Future future : futures) { future.get(); } + counter += buffer.length; } catch (IOException e) { /* TODO */ e.printStackTrace(); -- 2.7.4