From: David ‘Bombe’ Roden Date: Mon, 27 May 2013 20:15:55 +0000 (+0200) Subject: Count and expose the number of bytes that have been read from the connection’s source. X-Git-Url: https://git.pterodactylus.net/?p=sonitus.git;a=commitdiff_plain;h=57737deafd02c03fcea5c3a3465d910338558f29 Count and expose the number of bytes that have been read from the connection’s source. --- 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();