java.lang.Iterable<java.util.Map.Entry<java.lang.String,HostTxtEntry>>
class AddressBook extends java.lang.Object implements java.lang.Iterable<java.util.Map.Entry<java.lang.String,HostTxtEntry>>
修飾子とタイプ | フィールド | 説明 |
---|---|---|
(package private) static long |
MAX_SUB_SIZE |
コンストラクタ | 説明 |
---|---|
AddressBook(java.io.File file) |
Construct an AddressBook from the contents of the file at file.
|
AddressBook(java.lang.String testsubfile) |
Test only.
|
AddressBook(java.util.Map<java.lang.String,HostTxtEntry> addresses) |
Construct an AddressBook from the contents of the Map addresses.
|
AddressBook(Subscription subscription,
java.lang.String proxyHost,
int proxyPort) |
Construct an AddressBook from the Subscription subscription.
|
修飾子とタイプ | メソッド | 説明 |
---|---|---|
void |
delete() |
Delete the temp file or clear the map.
|
java.lang.String |
getLocation() |
Return the location of the file this AddressBook was constructed from.
|
static boolean |
isValidKey(java.lang.String host) |
Do basic validation of the hostname
hostname was already converted to lower case by HostTxtParser.parse()
|
java.util.Iterator<java.util.Map.Entry<java.lang.String,HostTxtEntry>> |
iterator() |
Return an iterator over the addresses in the AddressBook.
|
void |
merge(AddressBook other,
boolean overwrite,
Log log) |
Merge this AddressBook with AddressBook other, writing messages about new
addresses or conflicts to log.
|
java.lang.String |
toString() |
Return a string representation of the origin of the AddressBook.
|
void |
write() |
Write this AddressBook out to the file it was read from.
|
void |
write(java.io.File file) |
Write the contents of this AddressBook out to the File file.
|
static final long MAX_SUB_SIZE
public AddressBook(java.util.Map<java.lang.String,HostTxtEntry> addresses)
addresses
- A Map containing human readable addresses as keys, mapped to
base64 i2p destinations.public AddressBook(Subscription subscription, java.lang.String proxyHost, int proxyPort)
subscription
- A Subscription instance pointing at a remote address book.proxyHost
- hostname of proxyproxyPort
- port number of proxypublic AddressBook(java.io.File file)
file
- A File pointing at a file with lines in the format
"key=value", where key is a human readable name, and value is
a base64 i2p destination.public AddressBook(java.lang.String testsubfile)
testsubfile
- path to a file containing the simulated fetch of a subscriptionpublic java.util.Iterator<java.util.Map.Entry<java.lang.String,HostTxtEntry>> iterator()
iterator
インタフェース内 java.lang.Iterable<java.util.Map.Entry<java.lang.String,HostTxtEntry>>
public void delete()
public java.lang.String getLocation()
public java.lang.String toString()
toString
クラス内 java.lang.Object
public static boolean isValidKey(java.lang.String host)
public void merge(AddressBook other, boolean overwrite, Log log)
other
- An AddressBook to merge with.overwrite
- True to overwritelog
- The log to write messages about new addresses or conflicts to. May be null.java.lang.IllegalStateException
- if this was created with the Subscription constructor.public void write(java.io.File file)
file
- The file to write the contents of this AddressBook too.java.lang.IllegalStateException
- if this was created with the Subscription constructor.public void write()
java.lang.IllegalStateException
- if this was not created with the File constructor.