Package net.i2p.addressbook
Class HostTxtIterator
- java.lang.Object
-
- net.i2p.addressbook.HostTxtIterator
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Iterator<Map.Entry<String,HostTxtEntry>>
class HostTxtIterator extends Object implements Iterator<Map.Entry<String,HostTxtEntry>>, Closeable
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
Constructors Constructor Description HostTxtIterator()
A dummy iterator in which hasNext() is always false.HostTxtIterator(File file)
An iterator over the key/value pairs in the file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
boolean
hasNext()
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.void
remove()
-
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 Detail
-
HostTxtIterator
public HostTxtIterator()
A dummy iterator in which hasNext() is always false.
-
HostTxtIterator
public HostTxtIterator(File file) throws IOException
An iterator over the key/value pairs in the file.- Throws:
IOException
-
-
Method Detail
-
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interfaceIterator<Map.Entry<String,HostTxtEntry>>
-
next
public 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
-
-