/** * Save entities * * @param b the Board from which the Entities come * @param r the writer to which the entities should be written * @throws IOException Signals that an I/O exception has occurred. */ public static void saveEntities(GameBoard b, BufferedWriter r) throws IOException { Iterator<Entity> e = b.getIngameEntities().iterator(); while (e.hasNext()) { Entity en = e.next(); if (!Player.class.isAssignableFrom(en.getClass())) { r.write(en.saveToString()); r.newLine(); } } }