Changeset 30738 in osm for applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadSVGBuilding.java
- Timestamp:
- 2014-10-19T01:27:04+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadSVGBuilding.java
r30737 r30738 43 43 private static String errorMessage; 44 44 45 45 /** 46 * Constructs a new {@code DownloadSVGBuilding}. 47 */ 46 48 public DownloadSVGBuilding(WMSLayer wmsLayer) { 47 49 super(tr("Downloading {0}", wmsLayer.getName())); … … 240 242 wmsInterface.urlConn.setRequestMethod("GET"); 241 243 wmsInterface.setCookie(); 242 InputStream is = new ProgressInputStream(wmsInterface.urlConn, NullProgressMonitor.INSTANCE);243 244 File file = new File(CadastrePlugin.cacheDir + "building.svg"); 244 245 String svg = new String(); 245 try { 246 try (InputStream is = new ProgressInputStream(wmsInterface.urlConn, NullProgressMonitor.INSTANCE)) { 246 247 if (file.exists()) 247 248 file.delete(); 248 BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file, true)); 249 InputStreamReader isr =new InputStreamReader(is); 250 BufferedReader br = new BufferedReader(isr); 251 String line=""; 252 while ( null!=(line=br.readLine())){ 253 line += "\n"; 254 bos.write(line.getBytes()); 255 svg += line; 256 } 257 br.close(); 258 bos.close(); 249 try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file, true)); 250 InputStreamReader isr = new InputStreamReader(is); 251 BufferedReader br = new BufferedReader(isr)) { 252 String line=""; 253 while ( null!=(line=br.readLine())){ 254 line += "\n"; 255 bos.write(line.getBytes()); 256 svg += line; 257 } 258 } 259 259 } catch (IOException e) { 260 e.printStackTrace(System.out); 261 } 262 is.close(); 260 Main.error(e); 261 } 263 262 return svg; 264 263 }
Note:
See TracChangeset
for help on using the changeset viewer.