import java.io.*;

public class FileAccess {
  
  /** read each line of a file and display the contents 
   * on the screen
   */
  public static void displayFile(String filename) 
    throws IOException {
    // a FileReader only reads a character at a time
    FileReader f = new FileReader(filename);
    /* the buffered reader saves (buffers) all the characters
       until it reaches an end of line/file character.  It
       then returns the whole line at once each time readLine
       is called .
    */
    BufferedReader br = new BufferedReader(f);
    String temp = br.readLine();
    
    while(temp != null) {
      System.out.println(temp);
      temp = br.readLine();
    }
    /* don't forget to close up before you leave! */
    f.close();
    br.close();
  }
}
