
import java.io.*;
import java.util.*;

public class JoggleReader
{
    public JoggleReader()
    {
	myWordList = new Vector(10000);
    }

    public void ReadWords()
    {
	String s;
	FileInputStream f = null;
	DataInputStream stream = null;
	try
	{
	    f = new FileInputStream("bogdict.txt");
	    stream = new DataInputStream(f);
	    int count = 0;
	    while ((s = stream.readLine()) != null)
	    {
		myWordList.addElement(new String(s));
		count++;
		if (count % 1000 == 0)
		{
		    System.out.println("read "+count+ " words");
		}
	    } 
	}
	catch (IOException e)
	{
	    e.printStackTrace();
	    System.err.println("error reading dictionary");
	    System.err.println(e.getMessage());
	}
	finally
	{
	    if (f != null)
	    {
		try {
		    f.close(); 
		}
		catch (IOException e) {
		    // nothing here
		}
	    }
	}
    }
    
    public void PrintWords()
    {
	Enumeration e = myWordList.elements();
	while (e.hasMoreElements())
	{
	    System.out.println(e.nextElement());
	}
    }

//    public static void main(String args[])
//    {
//	JoggleReader j = new JoggleReader();
//	j.ReadWords();
//	j.PrintWords();
//    }

    public Vector myWordList;       
}

