Package net.i2p.addressbook
Class HostTxtIterator
java.lang.Object
net.i2p.addressbook.HostTxtIterator
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Iterator<Map.Entry<String,
HostTxtEntry>>
A class to iterate through a hosts.txt or config file without
reading the whole thing into memory.
Keys are always converted to lower case.
Callers should iterate all the way through or call close()
to ensure the underlying stream is closed.
This is not used for config files.
It is only used for subscriptions.
- Since:
- 0.8.7, renamed from ConfigIterator in 0.9.26
-
Constructor Summary
ConstructorDescriptionA dummy iterator in which hasNext() is always false.HostTxtIterator
(File file) An iterator over the key/value pairs in the file. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
HostTxtIterator
public HostTxtIterator()A dummy iterator in which hasNext() is always false. -
HostTxtIterator
An iterator over the key/value pairs in the file.- Throws:
IOException
-
-
Method Details
-
hasNext
public boolean hasNext()- Specified by:
hasNext
in interfaceIterator<Map.Entry<String,
HostTxtEntry>>
-
next
'remove' entries will be returned with a null key, and the value will contain a null name, null dest, and non-null props.- Specified by:
next
in interfaceIterator<Map.Entry<String,
HostTxtEntry>>
-
remove
public void remove()- Specified by:
remove
in interfaceIterator<Map.Entry<String,
HostTxtEntry>>
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-