/** * Loads a map from a file. * * @param file A FileReader object that contains the map data. */ void loadMapFile(FileReader file) { String buf, data = ""; try { BufferedReader br = new BufferedReader(file); while ((buf = br.readLine()) != null) { data += buf; } br.close(); file.close(); } catch (IOException e) { System.out.println("Can't open file"); System.exit(0); } loadMap(data); }