import java.io.*;

public class Cliente {

  public static void leggiDaFile(String nomefile, PhotoGallery g) 
                                               throws IOException {
    FileReader f = new FileReader(nomefile);
    BufferedReader br = new BufferedReader(f);
    String s = br.readLine();
    while (s!=null) {
      g.aggiungi(s);
      s = br.readLine();
    }
    f.close(); // o equivalentemente br.close();
  }



  // metodo non richiesto dalla traccia
  public static void scriviSuFile(String nomefile, PhotoGallery g) 
                                              throws IOException {
    FileWriter f = new FileWriter(nomefile);
    PrintWriter out = new PrintWriter(f);
    String[] arrayfoto = g.restituisciTutteLeFoto();
    for (int i = 0; i < arrayfoto.length; i++)
      out.println(arrayfoto[i]);
    f.close();  //oppure out.close();
  }

}
