Package com.inet.jortho
Class WordIterator
- java.lang.Object
-
- 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
Constructors Constructor Description 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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static java.io.InputStreamcreateInflaterStream(java.net.URL filename)Create a plain stream from a compressed file.booleanhasNext()java.lang.Stringnext()voidremove()
-
-
-
Constructor Detail
-
WordIterator
public WordIterator(java.net.URL filename) throws java.io.IOExceptionLoad 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.IOExceptionLoad the directory from plain a list of words. The words must be delimmited with newlines.- Parameters:
stream- a InputStream with wordscharsetName- 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.IOExceptionLoad 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
-
createInflaterStream
private static java.io.InputStream createInflaterStream(java.net.URL filename) throws java.io.IOExceptionCreate a plain stream from a compressed file.- Parameters:
filename- the file of a JOrtho dictionary- Returns:
- the stream
- Throws:
java.io.IOException- If an I/O error occurs.
-
hasNext
public boolean hasNext()
- Specified by:
hasNextin interfacejava.util.Iterator<java.lang.String>
-
next
public java.lang.String next()
- Specified by:
nextin interfacejava.util.Iterator<java.lang.String>
-
remove
public void remove()
- Specified by:
removein interfacejava.util.Iterator<java.lang.String>
-
-