/**
   * Creates a new NameSurferDataBase and initializes it using the data in the specified file. The
   * constructor throws an error exception if the requested file does not exist or if an error
   * occurs as the file is being read.
   */
  public NameSurferDataBase(String filename) {

    try {
      BufferedReader rd = new BufferedReader(new FileReader(filename));
      while (true) {
        String line = rd.readLine();
        if (line == null) break;
        NameSurferEntry entry = new NameSurferEntry(line);
        namesDataBase.put(entry.getName(), entry);
      }
      rd.close();

    } catch (IOException ex) {
      throw new ErrorException(ex);
    }
  }