Changeset 7562 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2014-09-19T01:13:02+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/OsmExporter.java
r7561 r7562 23 23 24 24 /** 25 * Exports data to an . Osm file.25 * Exports data to an .osm file. 26 26 * @since 1949 27 27 */ … … 68 68 } 69 69 70 protected static finalvoid checkOsmDataLayer(Layer layer) throws IllegalArgumentException {70 protected static void checkOsmDataLayer(Layer layer) throws IllegalArgumentException { 71 71 if (!(layer instanceof OsmDataLayer)) { 72 72 throw new IllegalArgumentException(MessageFormat.format("Expected instance of OsmDataLayer. Got ''{0}''.", layer … … 90 90 } 91 91 92 // create outputstream and wrap it with gzip or bzip, if necessary 93 try ( 94 OutputStream out = getOutputStream(file); 95 Writer writer = new OutputStreamWriter(out, StandardCharsets.UTF_8); 96 OsmWriter w = OsmWriterFactory.createOsmWriter(new PrintWriter(writer), false, layer.data.getVersion()); 97 ) { 98 layer.data.getReadLock().lock(); 99 try { 100 w.writeLayer(layer); 101 } finally { 102 layer.data.getReadLock().unlock(); 103 } 104 } 92 doSave(file, layer); 105 93 if (noBackup || !Main.pref.getBoolean("save.keepbackup", false)) { 106 94 if (tmpFile != null) { … … 135 123 } 136 124 } 125 126 protected void doSave(File file, OsmDataLayer layer) throws IOException, FileNotFoundException { 127 // create outputstream and wrap it with gzip or bzip, if necessary 128 try ( 129 OutputStream out = getOutputStream(file); 130 Writer writer = new OutputStreamWriter(out, StandardCharsets.UTF_8); 131 OsmWriter w = OsmWriterFactory.createOsmWriter(new PrintWriter(writer), false, layer.data.getVersion()); 132 ) { 133 layer.data.getReadLock().lock(); 134 try { 135 w.writeLayer(layer); 136 } finally { 137 layer.data.getReadLock().unlock(); 138 } 139 } 140 } 137 141 }
Note:
See TracChangeset
for help on using the changeset viewer.