Assignment #3

This assignment asks you to do some simple I/O. You will read a file that contains an unknown number of words into an array of String. Print out the exact number of words read. The file is contained on the Internet. There are two versions of the assignment. Do both.

Version #1

Version #1 of the program gets the file located at http://www.cs.fiu.edu/~weiss/cop3337/assignments/dict.txt. Here is some starter code (you will need to find the appropriate import directives.
URL url = new URL( "http://www.cs.fiu.edu/~weiss/cop3337/assignments/dict.txt" );
InputStream is = url.openStream( );
Once you have the InputStream you can use a Scanner to read a line at a time. Then you can use ArrayList to store the strings.

Version #2

The URL http://www.cs.fiu.edu/~weiss/cop3337/assignments/dict.ser.gz stores a String[] in compressed gzip form. Open up the URL, wrap inside a BufferedInputStream, then a GZIPInputStream, and then a ObjectInputStream, and call readObject. You will get the entire String array in a single read.