Ignore:
Timestamp:
2018-01-21T23:28:56+01:00 (22 months ago)
Author:
Don-vip
Message:

fix #15816 - full XZ support

Location:
trunk/src/org/openstreetmap/josm/io
Files:
2 edited

Legend:

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

    r12679 r13352  
    8484     */
    8585    public enum NoteUrlPattern {
     86        /** URL of OSM API Notes endpoint */
    8687        API_URL  ("https?://.*/api/0.6/notes.*"),
    87         DUMP_FILE("https?://.*/(.*\\.osn(.bz2)?)");
     88        /** URL of OSM API Notes compressed dump file */
     89        DUMP_FILE("https?://.*/(.*\\.osn(\\.(gz|xz|bz2?|zip))?)");
    8890
    8991        private final String urlPattern;
     
    147149
    148150    @Override
    149     public DataSet parseOsm(final ProgressMonitor progressMonitor) throws OsmTransferException {
    150         return doParse(new OsmParser(progressMonitor, Compression.NONE), progressMonitor);
    151     }
    152 
    153     @Override
    154     public DataSet parseOsmBzip2(final ProgressMonitor progressMonitor) throws OsmTransferException {
    155         return doParse(new OsmParser(progressMonitor, Compression.BZIP2), progressMonitor);
    156     }
    157 
    158     @Override
    159     public DataSet parseOsmGzip(final ProgressMonitor progressMonitor) throws OsmTransferException {
    160         return doParse(new OsmParser(progressMonitor, Compression.GZIP), progressMonitor);
    161     }
    162 
    163     @Override
    164     public DataSet parseOsmZip(final ProgressMonitor progressMonitor) throws OsmTransferException {
    165         return doParse(new OsmParser(progressMonitor, Compression.ZIP), progressMonitor);
    166     }
    167 
    168     @Override
    169     public DataSet parseOsmChange(final ProgressMonitor progressMonitor) throws OsmTransferException {
    170         return doParse(new OsmChangeParser(progressMonitor, Compression.NONE), progressMonitor);
    171     }
    172 
    173     @Override
    174     public DataSet parseOsmChangeBzip2(final ProgressMonitor progressMonitor) throws OsmTransferException {
    175         return doParse(new OsmChangeParser(progressMonitor, Compression.BZIP2), progressMonitor);
    176     }
    177 
    178     @Override
    179     public DataSet parseOsmChangeGzip(final ProgressMonitor progressMonitor) throws OsmTransferException {
    180         return doParse(new OsmChangeParser(progressMonitor, Compression.GZIP), progressMonitor);
    181     }
    182 
    183     @Override
    184     public GpxData parseRawGps(final ProgressMonitor progressMonitor) throws OsmTransferException {
    185         return doParse(new GpxParser(progressMonitor, Compression.NONE), progressMonitor);
    186     }
    187 
    188     @Override
    189     public GpxData parseRawGpsBzip2(final ProgressMonitor progressMonitor) throws OsmTransferException {
    190         return doParse(new GpxParser(progressMonitor, Compression.BZIP2), progressMonitor);
    191     }
    192 
    193     @Override
    194     public List<Note> parseRawNotes(final ProgressMonitor progressMonitor) throws OsmTransferException {
    195         return doParse(new NoteParser(progressMonitor, Compression.NONE), progressMonitor);
    196     }
    197 
    198     @Override
    199     public List<Note> parseRawNotesBzip2(final ProgressMonitor progressMonitor) throws OsmTransferException {
    200         return doParse(new NoteParser(progressMonitor, Compression.BZIP2), progressMonitor);
     151    public DataSet parseOsm(ProgressMonitor progressMonitor) throws OsmTransferException {
     152        return parseOsm(progressMonitor, Compression.NONE);
     153    }
     154
     155    @Override
     156    public DataSet parseOsm(ProgressMonitor progressMonitor, Compression compression) throws OsmTransferException {
     157        return doParse(new OsmParser(progressMonitor, compression), progressMonitor);
     158    }
     159
     160    @Override
     161    public DataSet parseOsmChange(ProgressMonitor progressMonitor) throws OsmTransferException {
     162        return parseOsmChange(progressMonitor, Compression.NONE);
     163    }
     164
     165    @Override
     166    public DataSet parseOsmChange(ProgressMonitor progressMonitor, Compression compression) throws OsmTransferException {
     167        return doParse(new OsmChangeParser(progressMonitor, compression), progressMonitor);
     168    }
     169
     170    @Override
     171    public GpxData parseRawGps(ProgressMonitor progressMonitor) throws OsmTransferException {
     172        return parseRawGps(progressMonitor, Compression.NONE);
     173    }
     174
     175    @Override
     176    public GpxData parseRawGps(ProgressMonitor progressMonitor, Compression compression) throws OsmTransferException {
     177        return doParse(new GpxParser(progressMonitor, compression), progressMonitor);
     178    }
     179
     180    @Override
     181    public List<Note> parseRawNotes(ProgressMonitor progressMonitor) throws OsmTransferException {
     182        return parseRawNotes(progressMonitor, Compression.NONE);
     183    }
     184
     185    @Override
     186    public List<Note> parseRawNotes(ProgressMonitor progressMonitor, Compression compression) throws OsmTransferException {
     187        return doParse(new NoteParser(progressMonitor, compression), progressMonitor);
    201188    }
    202189
  • trunk/src/org/openstreetmap/josm/io/OsmServerReader.java

    r12992 r13352  
    127127     * @param reason The reason to show on console. Can be {@code null} if no reason is given
    128128     * @param uncompressAccordingToContentDisposition Whether to inspect the HTTP header {@code Content-Disposition}
    129      *                                                for {@code filename} and uncompress a gzip/bzip2 stream.
     129     *                                                for {@code filename} and uncompress a gzip/bzip2/xz/zip stream.
    130130     * @return An reader reading the input stream (servers answer) or <code>null</code>.
    131131     * @throws OsmTransferException if data transfer errors occur
     
    143143     * @param reason The reason to show on console. Can be {@code null} if no reason is given
    144144     * @param uncompressAccordingToContentDisposition Whether to inspect the HTTP header {@code Content-Disposition}
    145      *                                                for {@code filename} and uncompress a gzip/bzip2 stream.
     145     *                                                for {@code filename} and uncompress a gzip/bzip2/xz/zip stream.
    146146     * @param httpMethod HTTP method ("GET", "POST" or "PUT")
    147147     * @param requestBody HTTP request body (for "POST" and "PUT" methods only). Must be null for "GET" method.
     
    248248
    249249    /**
    250      * Download OSM Change files from somewhere
    251      * @param progressMonitor The progress monitor
    252      * @return The corresponding dataset
    253      * @throws OsmTransferException if any error occurs
    254      */
    255     public DataSet parseOsmChange(final ProgressMonitor progressMonitor) throws OsmTransferException {
     250     * Download compressed OSM files from somewhere
     251     * @param progressMonitor The progress monitor
     252     * @param compression compression to use
     253     * @return The corresponding dataset
     254     * @throws OsmTransferException if any error occurs
     255     * @since 13352
     256     */
     257    public DataSet parseOsm(ProgressMonitor progressMonitor, Compression compression) throws OsmTransferException {
     258        return null;
     259    }
     260
     261    /**
     262     * Download OSM Change uncompressed files from somewhere
     263     * @param progressMonitor The progress monitor
     264     * @return The corresponding dataset
     265     * @throws OsmTransferException if any error occurs
     266     */
     267    public DataSet parseOsmChange(ProgressMonitor progressMonitor) throws OsmTransferException {
     268        return null;
     269    }
     270
     271    /**
     272     * Download OSM Change compressed files from somewhere
     273     * @param progressMonitor The progress monitor
     274     * @param compression compression to use
     275     * @return The corresponding dataset
     276     * @throws OsmTransferException if any error occurs
     277     * @since 13352
     278     */
     279    public DataSet parseOsmChange(ProgressMonitor progressMonitor, Compression compression) throws OsmTransferException {
    256280        return null;
    257281    }
     
    262286     * @return The corresponding dataset
    263287     * @throws OsmTransferException if any error occurs
    264      */
    265     public DataSet parseOsmChangeBzip2(final ProgressMonitor progressMonitor) throws OsmTransferException {
    266         return null;
     288     * @deprecated use {@link #parseOsmChange(ProgressMonitor, Compression)} instead
     289     */
     290    @Deprecated
     291    public DataSet parseOsmChangeBzip2(ProgressMonitor progressMonitor) throws OsmTransferException {
     292        return parseOsmChange(progressMonitor, Compression.BZIP2);
    267293    }
    268294
     
    272298     * @return The corresponding dataset
    273299     * @throws OsmTransferException if any error occurs
    274      */
    275     public DataSet parseOsmChangeGzip(final ProgressMonitor progressMonitor) throws OsmTransferException {
    276         return null;
     300     * @deprecated use {@link #parseOsmChange(ProgressMonitor, Compression)} instead
     301     */
     302    @Deprecated
     303    public DataSet parseOsmChangeGzip(ProgressMonitor progressMonitor) throws OsmTransferException {
     304        return parseOsmChange(progressMonitor, Compression.GZIP);
    277305    }
    278306
     
    283311     * @throws OsmTransferException if any error occurs
    284312     */
    285     public GpxData parseRawGps(final ProgressMonitor progressMonitor) throws OsmTransferException {
     313    public GpxData parseRawGps(ProgressMonitor progressMonitor) throws OsmTransferException {
     314        return null;
     315    }
     316
     317    /**
     318     * Retrieve compressed GPX files from somewhere.
     319     * @param progressMonitor The progress monitor
     320     * @param compression compression to use
     321     * @return The corresponding GPX tracks
     322     * @throws OsmTransferException if any error occurs
     323     * @since 13352
     324     */
     325    public GpxData parseRawGps(ProgressMonitor progressMonitor, Compression compression) throws OsmTransferException {
    286326        return null;
    287327    }
     
    292332     * @return The corresponding GPX tracks
    293333     * @throws OsmTransferException if any error occurs
     334     * @deprecated use {@link #parseRawGps(ProgressMonitor, Compression)} instead
    294335     * @since 6244
    295336     */
    296     public GpxData parseRawGpsBzip2(final ProgressMonitor progressMonitor) throws OsmTransferException {
    297         return null;
     337    @Deprecated
     338    public GpxData parseRawGpsBzip2(ProgressMonitor progressMonitor) throws OsmTransferException {
     339        return parseRawGps(progressMonitor, Compression.BZIP2);
    298340    }
    299341
     
    303345     * @return The corresponding dataset
    304346     * @throws OsmTransferException if any error occurs
    305      */
    306     public DataSet parseOsmBzip2(final ProgressMonitor progressMonitor) throws OsmTransferException {
    307         return null;
     347     * @deprecated use {@link #parseOsm(ProgressMonitor, Compression)} instead
     348     */
     349    @Deprecated
     350    public DataSet parseOsmBzip2(ProgressMonitor progressMonitor) throws OsmTransferException {
     351        return parseOsm(progressMonitor, Compression.BZIP2);
    308352    }
    309353
     
    313357     * @return The corresponding dataset
    314358     * @throws OsmTransferException if any error occurs
    315      */
    316     public DataSet parseOsmGzip(final ProgressMonitor progressMonitor) throws OsmTransferException {
    317         return null;
     359     * @deprecated use {@link #parseOsm(ProgressMonitor, Compression)} instead
     360     */
     361    @Deprecated
     362    public DataSet parseOsmGzip(ProgressMonitor progressMonitor) throws OsmTransferException {
     363        return parseOsm(progressMonitor, Compression.GZIP);
    318364    }
    319365
     
    323369     * @return The corresponding dataset
    324370     * @throws OsmTransferException if any error occurs
     371     * @deprecated use {@link #parseOsm(ProgressMonitor, Compression)} instead
    325372     * @since 6882
    326373     */
     374    @Deprecated
    327375    public DataSet parseOsmZip(final ProgressMonitor progressMonitor) throws OsmTransferException {
    328         return null;
     376        return parseOsm(progressMonitor, Compression.ZIP);
    329377    }
    330378
     
    385433
    386434    /**
     435     * Download notes from a URL that contains a compressed notes dump file
     436     * @param progressMonitor progress monitor
     437     * @param compression compression to use
     438     * @return A list of notes parsed from the URL
     439     * @throws OsmTransferException if any error occurs during dialog with OSM API
     440     * @since 13352
     441     */
     442    public List<Note> parseRawNotes(ProgressMonitor progressMonitor, Compression compression) throws OsmTransferException {
     443        return null;
     444    }
     445
     446    /**
    387447     * Download notes from a URL that contains a bzip2 compressed notes dump file
    388448     * @param progressMonitor progress monitor
    389449     * @return A list of notes parsed from the URL
    390450     * @throws OsmTransferException if any error occurs during dialog with OSM API
    391      */
     451     * @deprecated Use {@link #parseRawNotes(ProgressMonitor, Compression)} instead
     452     */
     453    @Deprecated
    392454    public List<Note> parseRawNotesBzip2(final ProgressMonitor progressMonitor) throws OsmTransferException {
    393         return null;
     455        return parseRawNotes(progressMonitor, Compression.BZIP2);
    394456    }
    395457
Note: See TracChangeset for help on using the changeset viewer.