maiolum.plainxml.indexing
Class IndexIterator

java.lang.Object
  extended bymaiolum.plainxml.indexing.IndexIterator
All Implemented Interfaces:
java.util.Iterator

public class IndexIterator
extends java.lang.Object
implements java.util.Iterator

Parses IndexItems from BufferedReader. Parsed items can be retrieved through the Iterator methods.

Author:
Robert Novotny

Constructor Summary
IndexIterator(java.io.BufferedReader reader)
          Constructs new IndexIterator over given BufferedReader.
IndexIterator(java.lang.String filename)
          Constructs new IndexIterator over index specified by filename in its String parameter.
 
Method Summary
 java.io.BufferedReader getReader()
          Returns associated BufferedReader, from which will be the index read.
 boolean hasNext()
          Determines, whether next call of next() method will return a valid non-&null; IndexItem.
static void main(java.lang.String[] args)
           
 java.lang.Object next()
          Retrieves next IndexItem from underlying index.
 void remove()
          This class does not support this method.
 void setReader(java.io.BufferedReader reader)
          Associates given BufferedReader with this Iterator.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IndexIterator

public IndexIterator(java.io.BufferedReader reader)
              throws IndexIOException
Constructs new IndexIterator over given BufferedReader. This method also reads first IndexItem and prepares it to be served in the following next() method call;

Parameters:
reader -
Throws:
IndexIOException, - if first IndexItem cannot be read from the BufferedReader.
IndexIOException

IndexIterator

public IndexIterator(java.lang.String filename)
              throws IndexIOException
Constructs new IndexIterator over index specified by filename in its String parameter. Also reads first IndexItem and prepares it to be served in the following next() method call;

Throws:
IndexIOException, - if first IndexItem cannot be read from the constructed BufferedReader.
IndexIOException
Method Detail

getReader

public java.io.BufferedReader getReader()
Returns associated BufferedReader, from which will be the index read.


setReader

public void setReader(java.io.BufferedReader reader)
Associates given BufferedReader with this Iterator.


hasNext

public boolean hasNext()
Determines, whether next call of next() method will return a valid non-&null; IndexItem. If there are no more items available, it also closes underlying BufferedReader.

Specified by:
hasNext in interface java.util.Iterator

next

public java.lang.Object next()
Retrieves next IndexItem from underlying index.

Specified by:
next in interface java.util.Iterator
Returns:
next IndexItem, or &null; if no more IndexItems are available.

remove

public void remove()
This class does not support this method.

Specified by:
remove in interface java.util.Iterator

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception