import java.io.*;
import java.util.*;
public class Auxiliaries {
 public static Vector readMovieFile(String fileName) {             
  boolean tryAgain = true;              
  Vector v = new Vector(); 
  while (tryAgain) {                    
   try {
    tryAgain = false;                   
    FileInputStream stream = new FileInputStream(fileName); 
    InputStreamReader reader = new InputStreamReader(stream);
    StreamTokenizer tokens = new StreamTokenizer(reader);
    tokens.quoteChar((int) '"'); 
    tokens.eolIsSignificant(true); 
    while (tokens.nextToken() != tokens.TT_EOF) {
     String nameString = tokens.sval;
     tokens.nextToken(); int x = (int) tokens.nval;
     tokens.nextToken(); int y = (int) tokens.nval;
     tokens.nextToken(); int z = (int) tokens.nval;
     Movie m = (new Movie(x, y, z));
     m.title = nameString;
     if (tokens.nextToken() == tokens.TT_EOL) {}
     else {m.poster = tokens.sval; tokens.nextToken();}
     v.addElement(m);
    }
    stream.close(); 
   }
   catch (FileNotFoundException e) {            
    tryAgain = true;                            
   }                                            
   catch (IOException e) {
    System.out.println(e);
   }
  }
  return v;
 }
}
