Changeset 30738 in osm for applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadSVGTask.java
- Timestamp:
- 2014-10-19T01:27:04+02:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadSVGTask.java
r30737 r30738 47 47 private static String errorMessage; 48 48 49 /** 50 * Constructs a new {@code DownloadSVGTask}. 51 */ 49 52 public DownloadSVGTask(WMSLayer wmsLayer) { 50 53 super(tr("Downloading {0}", wmsLayer.getName())); … … 194 197 wmsInterface.urlConn.setRequestMethod("GET"); 195 198 wmsInterface.setCookie(); 196 InputStream is = new ProgressInputStream(wmsInterface.urlConn, NullProgressMonitor.INSTANCE);197 199 File file = new File(CadastrePlugin.cacheDir + "boundary.svg"); 198 200 String svg = new String(); 199 try { 201 try (InputStream is = new ProgressInputStream(wmsInterface.urlConn, NullProgressMonitor.INSTANCE)) { 200 202 if (file.exists()) 201 203 file.delete(); 202 BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file, true)); 203 InputStreamReader isr =new InputStreamReader(is); 204 BufferedReader br = new BufferedReader(isr); 205 String line=""; 206 while ( null!=(line=br.readLine())){ 207 line += "\n"; 208 bos.write(line.getBytes()); 209 svg += line; 204 try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file, true)); 205 InputStreamReader isr =new InputStreamReader(is); 206 BufferedReader br = new BufferedReader(isr)) { 207 String line=""; 208 while ( null!=(line=br.readLine())){ 209 line += "\n"; 210 bos.write(line.getBytes()); 211 svg += line; 212 } 210 213 } 211 br.close();212 bos.close();213 214 } catch (IOException e) { 214 e.printStackTrace(System.out); 215 } 216 is.close(); 215 Main.error(e); 216 } 217 217 return svg; 218 218 }
Note:
See TracChangeset
for help on using the changeset viewer.
