Ignore:
Timestamp:
2014-06-14T12:40:50+02:00 (11 years ago)
Author:
bastiK
Message:

reworked MirroredInputStream (renamed to CachedFile):

  • no more awkwardly open and close InputStream if you just want the underlying file (e.g. to get file inside zip file)
  • make it easier to add configuration parameters, without having endless list of parameters for the constructor (Factory style, similar to ImageProvider)

breaks plugins; see #10139

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java

    r7242 r7248  
    1818import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType;
    1919import org.openstreetmap.josm.data.imagery.Shape;
    20 import org.openstreetmap.josm.io.MirroredInputStream;
     20import org.openstreetmap.josm.io.CachedFile;
    2121import org.openstreetmap.josm.io.UTFInputStreamReader;
    2222import org.xml.sax.Attributes;
     
    5050            SAXParserFactory factory = SAXParserFactory.newInstance();
    5151            factory.setNamespaceAware(true);
    52             try (InputStream in = new MirroredInputStream(source, null, 1*MirroredInputStream.DAYS, null,
    53                     MirroredInputStream.CachingStrategy.IfModifiedSince)) {
     52            try (InputStream in = new CachedFile(source)
     53                    .setMaxAge(1*CachedFile.DAYS)
     54                    .setCachingStrategy(CachedFile.CachingStrategy.IfModifiedSince)
     55                    .getInputStream()) {
    5456                InputSource is = new InputSource(UTFInputStreamReader.create(in));
    5557                factory.newSAXParser().parse(is, parser);
Note: See TracChangeset for help on using the changeset viewer.