import java.io.*;
import java.util.*;

/**
 * An example that illustrates the use of reading from a file
 * and using the StringTokenizer class.
 *
 * @author  Prof. David Bernstein, James Madison University
 * @version 1.0
 */
public class FacultyRecordTokenizer
{
    /**
     * The entry point of the application
     *
     * @param args   The command-line arguments
     */
    public static void main(String[] args)
    {
	BufferedReader       in;
	FileReader           fileReader;
	InputStreamReader    isReader;
	String               delimiters, email, line, name, phone;
	StringTokenizer      tokenizer;


        try
        {
            // Setup the reader and writer
            fileReader = new FileReader("cs.txt");
            in = new BufferedReader(fileReader);
            
            // Keep reading, tokenizing and processing
            while ((line = in.readLine()) != null)
            {
                tokenizer = new StringTokenizer(line, "\t", false);
                while (tokenizer.hasMoreTokens()) 
                {
                    try
                    {
                        name = tokenizer.nextToken();
                        phone = tokenizer.nextToken();
                        email = tokenizer.nextToken();
                        
                        // Do something with the information

                    }
                    catch (NoSuchElementException nsee)
                    {
                        // Do something when there is a problem
                    }
                }
            }
            in.close();
        }
        catch (IOException ioe)
        {
            System.err.println("IO Problem");
        }
    }
}
