java.lang.Object
net.i2p.addressbook.SubscriptionList
- All Implemented Interfaces:
Iterable<AddressBook>
A list of Subscriptions loaded from a file.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final longPause between fetches, in ms.private final FileWhere each subscription's ETag is remembered.private final FileWhere each subscription's last fetch time is remembered.private final FileWhere each subscription's last-modified date is remembered.private final StringProxy used for the fetches, null for none.private final intPort of that proxy.private final List<Subscription> The subscriptions, in file order.Constructor Summary
ConstructorsConstructorDescriptionSubscriptionList(File locationsFile, File etagsFile, File lastModifiedFile, File lastFetchedFile, long delay, List<String> defaultSubs, String proxyHost, int proxyPort) Construct a SubscriptionList using the urls from locationsFile and, if available, the etags and last-modified headers loaded from etagsFile and lastModifiedFile.SubscriptionList(String hoststxt) Testing only.Method Summary
All MethodsMethods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterable
forEach, spliterator
Field Details
subscriptions
The subscriptions, in file order.etagsFile
Where each subscription's ETag is remembered.lastModifiedFile
Where each subscription's last-modified date is remembered.lastFetchedFile
Where each subscription's last fetch time is remembered.delay
private final long delayPause between fetches, in ms.proxyHost
Proxy used for the fetches, null for none.proxyPort
private final int proxyPortPort of that proxy.
Constructor Details
SubscriptionList
public SubscriptionList(File locationsFile, File etagsFile, File lastModifiedFile, File lastFetchedFile, long delay, List<String> defaultSubs, String proxyHost, int proxyPort) Construct a SubscriptionList using the urls from locationsFile and, if available, the etags and last-modified headers loaded from etagsFile and lastModifiedFile.- Parameters:
locationsFile- A file containing one url on each line.etagsFile- A file containg the etag headers used for conditional GET. The file is in the format "url=etag".lastModifiedFile- A file containg the last-modified headers used for conditional GET. The file is in the format "url=leastmodified".lastFetchedFile- A file containing the last-fetched timestamps used to enforce the minimum delay between fetches. The file is in the format "url=lastfetched".delay- the minimum delay since last fetched for the iterator to actually fetchdefaultSubs- default subscription fileproxyHost- proxy hostname, null for no proxyproxyPort- proxy port number
SubscriptionList
Testing only.- Parameters:
hoststxt- path to a local file used as the test 'subscription' input
Method Details
iterator
Return an iterator over the AddressBooks represented by the Subscriptions in this SubscriptionList.- Specified by:
iteratorin interfaceIterable<AddressBook>- Returns:
- an iterator over the AddressBooks of every subscription
write
public void write()Write the etag and last-modified headers, and the last-fetched time, for each Subscription to files. BUG - If the subscription URL is a cgi containing an '=' the files won't be read back correctly; the '=' should be escaped.