Changeset 7561 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2014-09-19T01:04:08+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/OsmExporter.java
r7082 r7561 22 22 import org.openstreetmap.josm.tools.Utils; 23 23 24 /** 25 * Exports data to an .Osm file. 26 * @since 1949 27 */ 24 28 public class OsmExporter extends FileExporter { 25 29 … … 31 35 } 32 36 37 /** 38 * Constructs a new {@code OsmExporter}. 39 * @param filter The extension file filter 40 */ 33 41 public OsmExporter(ExtensionFileFilter filter) { 34 42 super(filter); … … 47 55 } 48 56 57 /** 58 * Exports OSM data to the given file. 59 * @param file Output file 60 * @param layer Data layer. Must be an instance of {@link OsmDataLayer}. 61 * @param noBackup if {@code true}, the potential backup file created if the output file already exists will be deleted 62 * after a successful export 63 * @throws IllegalArgumentException if {@code layer} is not an instance of {@code OsmDataLayer} 64 */ 49 65 public void exportData(File file, Layer layer, boolean noBackup) throws IllegalArgumentException { 50 if (layer instanceof OsmDataLayer) { 51 save(file, (OsmDataLayer) layer, noBackup); 52 } else 66 checkOsmDataLayer(layer); 67 save(file, (OsmDataLayer) layer, noBackup); 68 } 69 70 protected static final void checkOsmDataLayer(Layer layer) throws IllegalArgumentException { 71 if (!(layer instanceof OsmDataLayer)) { 53 72 throw new IllegalArgumentException(MessageFormat.format("Expected instance of OsmDataLayer. Got ''{0}''.", layer 54 73 .getClass().getName())); 74 } 55 75 } 56 76 57 protected OutputStream getOutputStream(File file) throws FileNotFoundException, IOException {77 protected static OutputStream getOutputStream(File file) throws FileNotFoundException, IOException { 58 78 return Compression.getCompressedFileOutputStream(file); 59 79 }
Note:
See TracChangeset
for help on using the changeset viewer.