net.i2p.addressbook
Class ConfigIterator

java.lang.Object
  extended by net.i2p.addressbook.ConfigIterator
All Implemented Interfaces:
Iterator<Map.Entry<String,String>>

 class ConfigIterator
extends Object
implements Iterator<Map.Entry<String,String>>

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.

Since:
0.8.7

Constructor Summary
ConfigIterator()
          A dummy iterator in which hasNext() is always false.
ConfigIterator(File file)
          An iterator over the key/value pairs in the file.
 
Method Summary
 void close()
           
protected  void finalize()
           
 boolean hasNext()
           
 Map.Entry<String,String> next()
           
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigIterator

public ConfigIterator()
A dummy iterator in which hasNext() is always false.


ConfigIterator

public ConfigIterator(File file)
An iterator over the key/value pairs in the file.

Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator<Map.Entry<String,String>>

next

public Map.Entry<String,String> next()
Specified by:
next in interface Iterator<Map.Entry<String,String>>

remove

public void remove()
Specified by:
remove in interface Iterator<Map.Entry<String,String>>

close

public void close()

finalize

protected void finalize()
Overrides:
finalize in class Object