Changeset 7248 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2014-06-14T12:40:50+02:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r7134 r7248 59 59 import org.openstreetmap.josm.Main; 60 60 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 61 import org.openstreetmap.josm.io.MirroredInputStream;62 61 import org.openstreetmap.josm.plugins.PluginHandler; 63 62 import org.w3c.dom.Element; … … 75 74 import com.kitfox.svg.SVGException; 76 75 import com.kitfox.svg.SVGUniverse; 76 import org.openstreetmap.josm.io.CachedFile; 77 77 78 78 /** … … 533 533 534 534 private static ImageResource getIfAvailableHttp(String url, ImageType type) { 535 try (MirroredInputStream is = new MirroredInputStream(url, 536 new File(Main.pref.getCacheDirectory(), "images").getPath())) { 535 CachedFile cf = new CachedFile(url) 536 .setDestDir(new File(Main.pref.getCacheDirectory(), "images").getPath()); 537 try (InputStream is = cf.getInputStream()) { 537 538 switch (type) { 538 539 case SVG: 539 URI uri = getSvgUniverse().loadSVG(is, Utils.fileToURL( is.getFile()).toString());540 URI uri = getSvgUniverse().loadSVG(is, Utils.fileToURL(cf.getFile()).toString()); 540 541 SVGDiagram svg = getSvgUniverse().getDiagram(uri); 541 542 return svg == null ? null : new ImageResource(svg); … … 543 544 BufferedImage img = null; 544 545 try { 545 img = read(Utils.fileToURL( is.getFile()), false, false);546 img = read(Utils.fileToURL(cf.getFile()), false, false); 546 547 } catch (IOException e) { 547 548 Main.warn("IOException while reading HTTP image: "+e.getMessage()); … … 800 801 }); 801 802 802 try (InputStream is = new MirroredInputStream( 803 base + fn, 804 new File(Main.pref.getPreferencesDir(), "images").toString()) 805 ) { 803 CachedFile cf = new CachedFile(base + fn).setDestDir(new File(Main.pref.getPreferencesDir(), "images").toString()); 804 try (InputStream is = cf.getInputStream()) { 806 805 parser.parse(new InputSource(is)); 807 806 } -
trunk/src/org/openstreetmap/josm/tools/RightAndLefthandTraffic.java
r7193 r7248 11 11 import org.openstreetmap.josm.data.osm.DataSet; 12 12 import org.openstreetmap.josm.data.osm.Way; 13 import org.openstreetmap.josm.io.CachedFile; 13 14 import org.openstreetmap.josm.io.IllegalDataException; 14 import org.openstreetmap.josm.io.MirroredInputStream;15 15 import org.openstreetmap.josm.io.OsmReader; 16 16 import org.openstreetmap.josm.tools.GeoPropertyIndex.GeoProperty; … … 67 67 private static void initialize() { 68 68 leftHandTrafficPolygons = new ArrayList<>(); 69 try (InputStream is = new MirroredInputStream("resource://data/left-right-hand-traffic.osm")) {69 try (InputStream is = new CachedFile("resource://data/left-right-hand-traffic.osm").getInputStream()) { 70 70 DataSet data = OsmReader.parseDataSet(is, null); 71 71 for (Way w : data.getWays()) { -
trunk/src/org/openstreetmap/josm/tools/XmlObjectParser.java
r7033 r7248 28 28 29 29 import org.openstreetmap.josm.Main; 30 import org.openstreetmap.josm.io. MirroredInputStream;30 import org.openstreetmap.josm.io.CachedFile; 31 31 import org.xml.sax.Attributes; 32 32 import org.xml.sax.ContentHandler; … … 281 281 public Iterable<Object> startWithValidation(final Reader in, String namespace, String schemaSource) throws SAXException { 282 282 SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); 283 try (InputStream mis = new MirroredInputStream(schemaSource)) {283 try (InputStream mis = new CachedFile(schemaSource).getInputStream()) { 284 284 Schema schema = factory.newSchema(new StreamSource(mis)); 285 285 ValidatorHandler validator = schema.newValidatorHandler();
Note: See TracChangeset
for help on using the changeset viewer.