import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.util.LinkedList; /** * * @author Jayson Falkner - jfalkner@umich.edu */ public class Dictionary { public String[] getWords() { LinkedList words = new LinkedList(); try { InputStream is = Dictionary.class.getClassLoader().getResourceAsStream("WORD.LST"); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); for (String s= br.readLine(); s != null; s = br.readLine()) { //System.out.println("\""+s+"\", "); words.add(s.trim()); } br.close(); isr.close(); is.close(); } catch (Exception e){ throw new RuntimeException(e); } return words.toArray(new String[0]); } }