Ignore:
Timestamp:
2014-06-14T12:40:50+02:00 (5 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

Location:
trunk/src/org/openstreetmap/josm/data/projection
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/projection/Projections.java

    r7082 r7248  
    3232import org.openstreetmap.josm.gui.preferences.projection.ProjectionChoice;
    3333import org.openstreetmap.josm.gui.preferences.projection.ProjectionPreference;
    34 import org.openstreetmap.josm.io.MirroredInputStream;
     34import org.openstreetmap.josm.io.CachedFile;
    3535import org.openstreetmap.josm.tools.Pair;
    3636
     
    133133        Pattern epsgPattern = Pattern.compile("<(\\d+)>(.*)<>");
    134134        try (
    135             InputStream in = new MirroredInputStream("resource://data/projection/epsg");
     135            InputStream in = new CachedFile("resource://data/projection/epsg").getInputStream();
    136136            BufferedReader r = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8));
    137137        ) {
  • trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2GridShiftFileWrapper.java

    r7033 r7248  
    44import java.io.InputStream;
    55
    6 import org.openstreetmap.josm.io.MirroredInputStream;
     6import org.openstreetmap.josm.io.CachedFile;
    77
    88/**
     
    4848    public NTV2GridShiftFile getShiftFile() {
    4949        if (instance == null) {
    50             try (InputStream is = new MirroredInputStream(gridFileName)) {
     50            try (InputStream is = new CachedFile(gridFileName).getInputStream()) {
    5151                instance = new NTV2GridShiftFile();
    5252                instance.loadGridShiftFile(is, false);
Note: See TracChangeset for help on using the changeset viewer.