com.inet.jortho
Class WordIterator

java.lang.Object
  extended by com.inet.jortho.WordIterator
All Implemented Interfaces:
java.util.Iterator<java.lang.String>

public class WordIterator
extends java.lang.Object
implements java.util.Iterator<java.lang.String>

A implementation of an Iterator which split a large text into lines. It is used to read words lists.


Constructor Summary
WordIterator(java.io.InputStream stream, java.lang.String charsetName)
          Load the directory from plain a list of words.
WordIterator(java.io.Reader reader)
          Load the directory from plain a list of words.
WordIterator(java.net.URL filename)
          Load the directory from a compressed list of words with UTF8 encoding.
 
Method Summary
 boolean hasNext()
          
 java.lang.String next()
          
 void remove()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WordIterator

public WordIterator(java.net.URL filename)
             throws java.io.IOException
Load the directory from a compressed list of words with UTF8 encoding. The words must be delimmited with newlines.

Parameters:
filename - the name of the file
Throws:
java.io.IOException - If an I/O error occurs.
java.lang.NullPointerException - If filename is null.

WordIterator

public WordIterator(java.io.InputStream stream,
                    java.lang.String charsetName)
             throws java.io.IOException
Load the directory from plain a list of words. The words must be delimmited with newlines.

Parameters:
stream - a InputStream with words
charsetName - the name of a codepage for example "UTF8" or "Cp1252"
Throws:
java.io.IOException - If an I/O error occurs.
java.lang.NullPointerException - If stream or charsetName is null.

WordIterator

public WordIterator(java.io.Reader reader)
             throws java.io.IOException
Load the directory from plain a list of words. The words must be delimmited with newlines.

Parameters:
reader - a Reader with words
Throws:
java.io.IOException - If an I/O error occurs.
java.lang.NullPointerException - If reader is null.
Method Detail

hasNext

public boolean hasNext()

Specified by:
hasNext in interface java.util.Iterator<java.lang.String>

next

public java.lang.String next()

Specified by:
next in interface java.util.Iterator<java.lang.String>

remove

public void remove()

Specified by:
remove in interface java.util.Iterator<java.lang.String>


Copyright © 2005 - 2009 i-net software. All Rights Reserved.