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.

- - ### Constructor Summary

    Constructors
    Constructor and 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 and 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

    - #### close

          public void close()

      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`

    - #### hasNext

          public boolean hasNext()

      Specified by:
        `hasNext` in interface `Iterator<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 interface `Iterator<Map.Entry<String,HostTxtEntry>>`

    - #### remove

          public void remove()

      Specified by:
        `remove` in interface `Iterator<Map.Entry<String,HostTxtEntry>>`