projects
/
sonitus.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Count and expose the number of bytes that have been read from the connection’s source.
[sonitus.git]
/
src
/
main
/
java
/
net
/
pterodactylus
/
sonitus
/
data
/
Pipeline.java
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
(file)
--- 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<Controlled> {
/** The executor service. */
private final ExecutorService executorService;
/** The executor service. */
private final ExecutorService executorService;
+ /** The number of copied bytes. */
+ private long counter;
+
/**
* Creates a new connection.
*
/**
* Creates a new connection.
*
@@
-279,6
+282,20
@@
public class Pipeline implements Iterable<Controlled> {
}
//
}
//
+ // 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
//
// ACTIONS
//
@@
-333,6
+350,7
@@
public class Pipeline implements Iterable<Controlled> {
for (Future<Void> future : futures) {
future.get();
}
for (Future<Void> future : futures) {
future.get();
}
+ counter += buffer.length;
} catch (IOException e) {
/* TODO */
e.printStackTrace();
} catch (IOException e) {
/* TODO */
e.printStackTrace();