java.lang.Object
net.i2p.addressbook.SubscriptionIterator
- All Implemented Interfaces:
Iterator<AddressBook>
An iterator over the subscriptions in a SubscriptionList. Note that this iterator returns AddressBook objects, and not Subscription objects. Yes, the EepGet fetch() is done in here in
next().Field Summary
FieldsModifier and TypeFieldDescriptionprivate final longPause between fetches, in ms.private final StringProxy to fetch the subscription through, if any.private final intPort of that proxy.private final Iterator<Subscription> The subscriptions being walked.Constructor Summary
ConstructorsConstructorDescriptionSubscriptionIterator(List<Subscription> subscriptions, long delay, String proxyHost, int proxyPort) Construct a SubscriptionIterator using the Subscriptions in List subscriptions.Method Summary
All MethodsMethods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterator
forEachRemaining
Field Details
subIterator
The subscriptions being walked.proxyHost
Proxy to fetch the subscription through, if any.proxyPort
private final int proxyPortPort of that proxy.delay
private final long delayPause between fetches, in ms.
Constructor Details
SubscriptionIterator
public SubscriptionIterator(List<Subscription> subscriptions, long delay, String proxyHost, int proxyPort) Construct a SubscriptionIterator using the Subscriptions in List subscriptions.- Parameters:
subscriptions- List of Subscription objects that represent address books.delay- the minimum delay since last fetched for the iterator to actually fetchproxyHost- proxy hostname, null for no proxyproxyPort- proxy port number
Method Details
hasNext
public boolean hasNext()- Specified by:
hasNextin interfaceIterator<AddressBook>- Returns:
- whether next is present
next
Fetch the next subscription's address book, if the delay has been met.- Specified by:
nextin interfaceIterator<AddressBook>- Returns:
- non-null AddressBook (empty if the minimum delay has not been met, or there is no proxy tunnel, or the fetch otherwise fails)
remove
public void remove()Not supported.- Specified by:
removein interfaceIterator<AddressBook>- Throws:
UnsupportedOperationException- ifremove()is called on this iterator