- Timestamp:
- 2009-06-28T14:40:12+02:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/MirroredInputStream.java
r1523 r1711 21 21 public class MirroredInputStream extends InputStream { 22 22 InputStream fs = null; 23 File file = null; 23 24 24 25 public MirroredInputStream(String name) throws IOException { … … 30 31 } 31 32 33 public MirroredInputStream(String name, String destDir) throws IOException { 34 this(name, destDir, -1L); 35 } 36 32 37 public MirroredInputStream(String name, String destDir, long maxTime) throws IOException { 33 38 URL url; 34 File file = null;35 39 try { 36 40 url = new URL(name); … … 53 57 throw new IOException(); 54 58 fs = new FileInputStream(file); 59 } 60 61 public File getFile() 62 { 63 return file; 55 64 } 56 65 -
trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r1677 r1711 15 15 import java.awt.image.BufferedImage; 16 16 import java.io.File; 17 import java.io.IOException; 17 18 import java.net.MalformedURLException; 18 19 import java.net.URL; … … 28 29 29 30 import org.openstreetmap.josm.Main; 31 import org.openstreetmap.josm.io.MirroredInputStream; 30 32 31 33 /** … … 85 87 if (name == null) 86 88 return null; 89 if (name.startsWith("http://")) 90 { 91 Image img = cache.get(name); 92 if(img == null) 93 { 94 try 95 { 96 MirroredInputStream is = new MirroredInputStream(name, 97 new File(Main.pref.getPreferencesDir(), "images").toString()); 98 if(is != null) 99 { 100 img = Toolkit.getDefaultToolkit().createImage(is.getFile().toURI().toURL()); 101 cache.put(name, img); 102 } 103 } 104 catch(IOException e) { 105 } 106 } 107 return img == null ? null : new ImageIcon(img); 108 } 87 109 if (subdir == null) 88 110 subdir = "";
Note:
See TracChangeset
for help on using the changeset viewer.