/** * saves a static map to the given directory. * * @param header * The header to use. * @param data * The data to save. * @param out * This parameter is optional. If it is not null, the stream is used to save the map to this location. If it is null, the map is saved in the default location. * @throws IOException * If any IO error occurred. */ public synchronized void saveNewMap(jsettlers.logic.map.loading.newmap.MapFileHeader header, IMapData data, OutputStream out) throws IOException { try { if (out == null) { out = mapDirectories.iterator().next().getOutputStream(header); } header.writeTo(out); FreshMapSerializer.serialize(data, out); } finally { if (out != null) { out.close(); } } loadFileList(); }