Changeset 29528 in osm for applications/viewer/jmapviewer/src
- Timestamp:
- 2013-04-21T17:34:47+02:00 (12 years ago)
- Location:
- applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/OsmFileCacheTileLoader.java
r29516 r29528 304 304 protected byte[] loadTileInBuffer(URLConnection urlConn) throws IOException { 305 305 input = urlConn.getInputStream(); 306 ByteArrayOutputStream bout = new ByteArrayOutputStream(input.available()); 307 byte[] buffer = new byte[2048]; 308 boolean finished = false; 309 do { 310 int read = input.read(buffer); 311 if (read >= 0) { 312 bout.write(buffer, 0, read); 313 } else { 314 finished = true; 315 } 316 } while (!finished); 317 if (bout.size() == 0) 318 return null; 319 return bout.toByteArray(); 306 try { 307 ByteArrayOutputStream bout = new ByteArrayOutputStream(input.available()); 308 byte[] buffer = new byte[2048]; 309 boolean finished = false; 310 do { 311 int read = input.read(buffer); 312 if (read >= 0) { 313 bout.write(buffer, 0, read); 314 } else { 315 finished = true; 316 } 317 } while (!finished); 318 if (bout.size() == 0) 319 return null; 320 return bout.toByteArray(); 321 } finally { 322 input.close(); 323 input = null; 324 } 320 325 } 321 326 -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/OsmTileLoader.java
r29516 r29528 58 58 } else { 59 59 input = conn.getInputStream(); 60 tile.loadImage(input); 61 input.close(); 62 input = null; 60 try { 61 tile.loadImage(input); 62 } finally { 63 input.close(); 64 input = null; 65 } 63 66 } 64 67 tile.setLoaded(true);
Note:
See TracChangeset
for help on using the changeset viewer.