From 64242ace72a2ad370d16a0e6a08f8be9fb29c4ab Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Sat, 10 Jan 2015 18:00:18 +0100 Subject: [PATCH] Add PacketCollector.getCollectedCount() --- .../java/org/jivesoftware/smack/PacketCollector.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/PacketCollector.java b/smack-core/src/main/java/org/jivesoftware/smack/PacketCollector.java index ba78224ea..14111003b 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/PacketCollector.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/PacketCollector.java @@ -166,6 +166,7 @@ public class PacketCollector { * until a packet is available or the timeout has elapsed. If the * timeout elapses without a result, null will be returned. * + * @param timeout the timeout in milliseconds. * @return the next available packet. */ @SuppressWarnings("unchecked") @@ -218,6 +219,16 @@ public class PacketCollector { return result; } + /** + * Get the number of collected stanzas this packet collector has collected so far. + * + * @return the count of collected stanzas. + * @since 4.1 + */ + public int getCollectedCount() { + return resultQueue.size(); + } + /** * Processes a packet to see if it meets the criteria for this packet collector. * If so, the packet is added to the result queue.