import java.io.* ; import java.util.*; /** methods for reading the movie database @author Patrick Prosser @ version 2.718 */ public class MovieReader { private BufferedReader fin; private StringTokenizer s; private String b; private String delimiter; public MovieReader(String fname) throws FileNotFoundException, IOException { delimiter = "/"; s = null; b = ""; fin = new BufferedReader(new FileReader(fname)); } public boolean hasNextMovie() throws IOException { if ((b = fin.readLine()) != null){ s = new StringTokenizer(b,delimiter); return true; } else { return false; } } public boolean hasNextActor(){return s.hasMoreTokens();} public String nextTitle(){return s.nextToken();} public String nextActor(){return s.nextToken();} public void close() throws IOException {fin.close();} }