Changeset 13352 in josm


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

fix #15816 - full XZ support

Location:
trunk
Files:
1 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/.classpath

    r13342 r13352  
    11<?xml version="1.0" encoding="UTF-8"?>
    22<classpath>
    3         <classpathentry excluding="org/apache/commons/compress/compressors/CompressorException.java|org/apache/commons/compress/compressors/CompressorStreamFactory.java|org/apache/commons/compress/compressors/CompressorStreamProvider.java|org/apache/commons/compress/compressors/FileNameUtil.java|org/apache/commons/compress/compressors/brotli/|org/apache/commons/compress/compressors/bzip2/BZip2Utils.java|org/apache/commons/compress/compressors/deflate/|org/apache/commons/compress/compressors/gzip/|org/apache/commons/compress/compressors/lz4/|org/apache/commons/compress/compressors/lz77support/|org/apache/commons/compress/compressors/lzma/|org/apache/commons/compress/compressors/pack200/|org/apache/commons/compress/compressors/snappy/|org/apache/commons/compress/compressors/xz/|org/apache/commons/compress/compressors/z/|org/apache/commons/compress/utils/ArchiveUtils.java|org/apache/commons/jcs/JCS.java|org/apache/commons/jcs/access/GroupCacheAccess.java|org/apache/commons/jcs/access/PartitionedCacheAccess.java|org/apache/commons/jcs/access/behavior/IGroupCacheAccess.java|org/apache/commons/jcs/access/exception/InvalidGroupException.java|org/apache/commons/jcs/admin/servlet/|org/apache/commons/jcs/auxiliary/AbstractAuxiliaryCacheMonitor.java|org/apache/commons/jcs/auxiliary/disk/jdbc/|org/apache/commons/jcs/auxiliary/lateral/|org/apache/commons/jcs/auxiliary/remote/AbstractRemoteAuxiliaryCache.java|org/apache/commons/jcs/auxiliary/remote/AbstractRemoteCacheListener.java|org/apache/commons/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java|org/apache/commons/jcs/auxiliary/remote/RemoteCache.java|org/apache/commons/jcs/auxiliary/remote/RemoteCacheFactory.java|org/apache/commons/jcs/auxiliary/remote/RemoteCacheFailoverRunner.java|org/apache/commons/jcs/auxiliary/remote/RemoteCacheListener.java|org/apache/commons/jcs/auxiliary/remote/RemoteCacheManager.java|org/apache/commons/jcs/auxiliary/remote/RemoteCacheMonitor.java|org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWait.java|org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java|org/apache/commons/jcs/auxiliary/remote/RemoteCacheRestore.java|org/apache/commons/jcs/auxiliary/remote/http/|org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheStartupServlet.java|org/apache/commons/jcs/auxiliary/remote/server/TimeoutConfigurableRMISocketFactory.java|org/apache/commons/jcs/engine/CacheAdaptor.java|org/apache/commons/jcs/engine/CacheGroup.java|org/apache/commons/jcs/engine/CacheWatchRepairable.java|org/apache/commons/jcs/engine/ZombieCacheService.java|org/apache/commons/jcs/engine/ZombieCacheServiceNonLocal.java|org/apache/commons/jcs/engine/ZombieCacheWatch.java|org/apache/commons/jcs/engine/logging/CacheEventLoggerDebugLogger.java|org/apache/commons/jcs/utils/access/|org/apache/commons/jcs/utils/discovery/|org/apache/commons/jcs/utils/net/|org/apache/commons/jcs/utils/props/|org/apache/commons/jcs/utils/servlet/|org/apache/commons/logging/impl/AvalonLogger.java|org/apache/commons/logging/impl/Jdk13LumberjackLogger.java|org/apache/commons/logging/impl/Log4JLogger.java|org/apache/commons/logging/impl/LogKitLogger.java|org/apache/commons/logging/impl/ServletContextCleaner.java|org/openstreetmap/gui/jmapviewer/Demo.java|org/openstreetmap/gui/jmapviewer/JMapViewerTree.java|org/openstreetmap/gui/jmapviewer/checkBoxTree/|org/apache/commons/compress/archivers/|org/apache/commons/compress/changes/|org/apache/commons/compress/parallel/|org/apache/commons/compress/PasswordRequiredException.java|org/apache/commons/compress/compressors/zstandard/" kind="src" path="src"/>
     3        <classpathentry excluding="org/apache/commons/compress/PasswordRequiredException.java|org/apache/commons/compress/archivers/|org/apache/commons/compress/changes/|org/apache/commons/compress/compressors/CompressorException.java|org/apache/commons/compress/compressors/CompressorStreamFactory.java|org/apache/commons/compress/compressors/CompressorStreamProvider.java|org/apache/commons/compress/compressors/FileNameUtil.java|org/apache/commons/compress/compressors/brotli/|org/apache/commons/compress/compressors/bzip2/BZip2Utils.java|org/apache/commons/compress/compressors/deflate/|org/apache/commons/compress/compressors/gzip/|org/apache/commons/compress/compressors/lz4/|org/apache/commons/compress/compressors/lz77support/|org/apache/commons/compress/compressors/lzma/|org/apache/commons/compress/compressors/pack200/|org/apache/commons/compress/compressors/snappy/|org/apache/commons/compress/compressors/xz/XZUtils.java|org/apache/commons/compress/compressors/z/|org/apache/commons/compress/compressors/zstandard/|org/apache/commons/compress/parallel/|org/apache/commons/compress/utils/ArchiveUtils.java|org/apache/commons/jcs/JCS.java|org/apache/commons/jcs/access/GroupCacheAccess.java|org/apache/commons/jcs/access/PartitionedCacheAccess.java|org/apache/commons/jcs/access/behavior/IGroupCacheAccess.java|org/apache/commons/jcs/access/exception/InvalidGroupException.java|org/apache/commons/jcs/admin/servlet/|org/apache/commons/jcs/auxiliary/AbstractAuxiliaryCacheMonitor.java|org/apache/commons/jcs/auxiliary/disk/jdbc/|org/apache/commons/jcs/auxiliary/lateral/|org/apache/commons/jcs/auxiliary/remote/AbstractRemoteAuxiliaryCache.java|org/apache/commons/jcs/auxiliary/remote/AbstractRemoteCacheListener.java|org/apache/commons/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java|org/apache/commons/jcs/auxiliary/remote/RemoteCache.java|org/apache/commons/jcs/auxiliary/remote/RemoteCacheFactory.java|org/apache/commons/jcs/auxiliary/remote/RemoteCacheFailoverRunner.java|org/apache/commons/jcs/auxiliary/remote/RemoteCacheListener.java|org/apache/commons/jcs/auxiliary/remote/RemoteCacheManager.java|org/apache/commons/jcs/auxiliary/remote/RemoteCacheMonitor.java|org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWait.java|org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java|org/apache/commons/jcs/auxiliary/remote/RemoteCacheRestore.java|org/apache/commons/jcs/auxiliary/remote/http/|org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheStartupServlet.java|org/apache/commons/jcs/auxiliary/remote/server/TimeoutConfigurableRMISocketFactory.java|org/apache/commons/jcs/engine/CacheAdaptor.java|org/apache/commons/jcs/engine/CacheGroup.java|org/apache/commons/jcs/engine/CacheWatchRepairable.java|org/apache/commons/jcs/engine/ZombieCacheService.java|org/apache/commons/jcs/engine/ZombieCacheServiceNonLocal.java|org/apache/commons/jcs/engine/ZombieCacheWatch.java|org/apache/commons/jcs/engine/logging/CacheEventLoggerDebugLogger.java|org/apache/commons/jcs/utils/access/|org/apache/commons/jcs/utils/discovery/|org/apache/commons/jcs/utils/net/|org/apache/commons/jcs/utils/props/|org/apache/commons/jcs/utils/servlet/|org/apache/commons/logging/impl/AvalonLogger.java|org/apache/commons/logging/impl/Jdk13LumberjackLogger.java|org/apache/commons/logging/impl/Log4JLogger.java|org/apache/commons/logging/impl/LogKitLogger.java|org/apache/commons/logging/impl/ServletContextCleaner.java|org/openstreetmap/gui/jmapviewer/Demo.java|org/openstreetmap/gui/jmapviewer/JMapViewerTree.java|org/openstreetmap/gui/jmapviewer/checkBoxTree/" kind="src" path="src"/>
    44        <classpathentry including="data/|images/|resources/|styles/" kind="src" path=""/>
    55        <classpathentry kind="src" path="test/unit"/>
  • trunk/build.xml

    r13351 r13352  
    242242    <target name="compile-cots" depends="init">
    243243        <!-- COTS -->
    244         <javac srcdir="${src.dir}" includes="com/**,javax/**,oauth/**,org/apache/commons/**,org/glassfish/**,gnu/**" nowarn="on" encoding="iso-8859-1"
     244        <javac srcdir="${src.dir}" includes="com/**,javax/**,oauth/**,org/apache/commons/**,org/glassfish/**,org/tukaani/**,gnu/**" nowarn="on" encoding="iso-8859-1"
    245245            destdir="${build.dir}" target="${java.lang.version}" source="${java.lang.version}" debug="on" includeAntRuntime="false" createMissingPackageInfoClass="false">
    246246            <!-- get rid of "internal proprietary API" warning -->
     
    262262            <exclude name="org/apache/commons/compress/compressors/pack200/**"/>
    263263            <exclude name="org/apache/commons/compress/compressors/snappy/**"/>
     264            <exclude name="org/apache/commons/compress/compressors/xz/XZUtils.java"/>
    264265            <exclude name="org/apache/commons/compress/compressors/z/**"/>
    265266            <exclude name="org/apache/commons/compress/compressors/zstandard/**"/>
     
    296297        <!-- JMapViewer -->
    297298        <javac compiler="${javac.compiler}" sourcepath="" srcdir="${src.dir}"
    298             excludes="com/**,javax/**,oauth/**,org/apache/commons/**,org/glassfish/**,org/openstreetmap/gui/jmapviewer/Demo.java,org/openstreetmap/gui/jmapviewer/JMapViewerTree.java,org/openstreetmap/gui/jmapviewer/checkBoxTree/**,org/openstreetmap/josm/**,gnu/**"
     299            excludes="com/**,javax/**,oauth/**,org/apache/commons/**,org/glassfish/**,org/openstreetmap/gui/jmapviewer/Demo.java,org/openstreetmap/gui/jmapviewer/JMapViewerTree.java,org/openstreetmap/gui/jmapviewer/checkBoxTree/**,org/openstreetmap/josm/**,org/tukaani/**,gnu/**"
    299300            destdir="${build.dir}" target="${java.lang.version}" source="${java.lang.version}" debug="on" includeantruntime="false" createMissingPackageInfoClass="false" encoding="UTF-8">
    300301            <compilerclasspath>
     
    322323        <!-- JOSM -->
    323324        <javac compiler="${javac.compiler}" sourcepath="" srcdir="${src.dir}"
    324             excludes="com/**,javax/**,gnu/**,oauth/**,org/apache/commons/**,org/glassfish/**,org/openstreetmap/gui/jmapviewer/**"
     325            excludes="com/**,javax/**,gnu/**,oauth/**,org/apache/commons/**,org/glassfish/**,org/openstreetmap/gui/jmapviewer/**,org/tukaani/**"
    325326            destdir="${build.dir}" target="${java.lang.version}" source="${java.lang.version}" debug="on" includeantruntime="false" createMissingPackageInfoClass="false" encoding="UTF-8">
    326327            <compilerclasspath>
  • trunk/src/org/openstreetmap/josm/actions/ExtensionFileFilter.java

    r13350 r13352  
    103103                org.openstreetmap.josm.gui.io.importexport.OsmGzipExporter.class,
    104104                org.openstreetmap.josm.gui.io.importexport.OsmBzip2Exporter.class,
     105                org.openstreetmap.josm.gui.io.importexport.OsmXzExporter.class,
    105106                org.openstreetmap.josm.gui.io.importexport.GeoJSONExporter.class,
    106107                org.openstreetmap.josm.gui.io.importexport.WMSLayerExporter.class,
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadNotesTask.java

    r12679 r13352  
    2727import org.openstreetmap.josm.io.BoundingBoxDownloader;
    2828import org.openstreetmap.josm.io.BoundingBoxDownloader.MoreNotesException;
     29import org.openstreetmap.josm.io.Compression;
    2930import org.openstreetmap.josm.io.OsmApi;
    3031import org.openstreetmap.josm.io.OsmServerLocationReader;
     
    4748    /** Property defining number of days a bug needs to be closed to no longer be downloaded */
    4849    public static final IntegerProperty DAYS_CLOSED = new IntegerProperty("osm.notes.daysClosed", 7);
     50
     51    private static final String PATTERN_COMPRESS = "https?://.*/(.*\\.osn.(gz|xz|bz2?|zip))";
    4952
    5053    private DownloadTask downloadTask;
     
    7174    @Override
    7275    public Future<?> loadUrl(boolean newLayer, String url, ProgressMonitor progressMonitor) {
    73         if (url.endsWith(".bz2")) {
    74             downloadTask = new DownloadBzip2RawUrlTask(new OsmServerLocationReader(url), progressMonitor);
     76        if (url.matches(PATTERN_COMPRESS)) {
     77            downloadTask = new DownloadCompressedRawUrlTask(new OsmServerLocationReader(url), progressMonitor, Compression.byExtension(url));
    7578        } else {
    7679            downloadTask = new DownloadRawUrlTask(new OsmServerLocationReader(url), progressMonitor);
     
    210213    }
    211214
    212     class DownloadBzip2RawUrlTask extends DownloadTask {
    213 
    214         DownloadBzip2RawUrlTask(OsmServerReader reader, ProgressMonitor progressMonitor) {
     215    class DownloadCompressedRawUrlTask extends DownloadTask {
     216
     217        private final Compression compression;
     218
     219        DownloadCompressedRawUrlTask(OsmServerReader reader, ProgressMonitor progressMonitor, Compression compression) {
    215220            super(reader, progressMonitor);
     221            this.compression = compression;
    216222        }
    217223
     
    223229            ProgressMonitor subMonitor = progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false);
    224230            try {
    225                 notesData = reader.parseRawNotesBzip2(subMonitor);
     231                notesData = reader.parseRawNotes(subMonitor, compression);
    226232            } catch (OsmTransferException e) {
    227233                if (isCanceled())
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmChangeCompressedTask.java

    r12634 r13352  
    99import org.openstreetmap.josm.gui.MainApplication;
    1010import org.openstreetmap.josm.gui.progress.ProgressMonitor;
     11import org.openstreetmap.josm.io.Compression;
    1112import org.openstreetmap.josm.io.OsmServerLocationReader;
    1213import org.openstreetmap.josm.io.OsmTransferException;
    1314
    1415/**
    15  * Task allowing to download compressed OSM-Change files (gzip and bzip2)
     16 * Task allowing to download compressed OSM-Change files (gzip, xz and bzip2)
    1617 * @since 5361
    1718 */
    1819public class DownloadOsmChangeCompressedTask extends DownloadOsmChangeTask {
    1920
     21    private static final String PATTERN_COMPRESS = "https?://.*/(.*\\.osc.(gz|xz|bz2?|zip))";
     22
    2023    @Override
    2124    public String[] getPatterns() {
    22         return new String[]{"https?://.*/.*\\.osc.(gz|bz2?)"};
     25        return new String[]{PATTERN_COMPRESS};
    2326    }
    2427
     
    4043            protected DataSet parseDataSet() throws OsmTransferException {
    4144                ProgressMonitor subTaskMonitor = progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false);
    42                 if (url.matches("https?://.*/.*\\.osc.bz2?")) {
    43                     return reader.parseOsmChangeBzip2(subTaskMonitor);
    44                 } else {
    45                     return reader.parseOsmChangeGzip(subTaskMonitor);
    46                 }
     45                return reader.parseOsmChange(subTaskMonitor, Compression.byExtension(url));
    4746            }
    4847        };
    4948        currentBounds = null;
    50         // Extract .osc.gz/bz/bz2 filename from URL to set the new layer name
    51         extractOsmFilename("https?://.*/(.*\\.osc.(gz|bz2?))", url);
     49        // Extract .osc.gz/xz/bz/bz2/zip filename from URL to set the new layer name
     50        extractOsmFilename(PATTERN_COMPRESS, url);
    5251        return MainApplication.worker.submit(downloadTask);
    5352    }
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmCompressedTask.java

    r12634 r13352  
    1010import org.openstreetmap.josm.gui.MainApplication;
    1111import org.openstreetmap.josm.gui.progress.ProgressMonitor;
     12import org.openstreetmap.josm.io.Compression;
    1213import org.openstreetmap.josm.io.OsmServerLocationReader;
    1314import org.openstreetmap.josm.io.OsmTransferException;
    1415
    1516/**
    16  * Task allowing to download compressed OSM files (gzip and bzip2)
     17 * Task allowing to download compressed OSM files (gzip, xz and bzip2)
    1718 * @since 5317
    1819 */
    1920public class DownloadOsmCompressedTask extends DownloadOsmTask {
    2021
    21     private static final String PATTERN_COMPRESS = "https?://.*/.*\\.osm.(gz|bz2?|zip)";
     22    private static final String PATTERN_COMPRESS = "https?://.*/(.*\\.osm\\.(gz|xz|bz2?|zip))";
    2223
    2324    @Override
     
    3233
    3334    @Override
    34     public Future<?> download(boolean newLayer, Bounds downloadArea,
    35             ProgressMonitor progressMonitor) {
     35    public Future<?> download(boolean newLayer, Bounds downloadArea, ProgressMonitor progressMonitor) {
    3636        return null;
    3737    }
     
    4949            protected DataSet parseDataSet() throws OsmTransferException {
    5050                ProgressMonitor subTaskMonitor = progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false);
    51                 if (url.matches("https?://.*/.*\\.osm.bz2?")) {
    52                     return reader.parseOsmBzip2(subTaskMonitor);
    53                 } else if (url.matches("https?://.*/.*\\.osm.gz")) {
    54                     return reader.parseOsmGzip(subTaskMonitor);
    55                 } else {
    56                     return reader.parseOsmZip(subTaskMonitor);
    57                 }
     51                return reader.parseOsm(subTaskMonitor, Compression.byExtension(url));
    5852            }
    5953        };
    6054        currentBounds = null;
    6155        // Extract .osm.gz/bz/bz2/zip filename from URL to set the new layer name
    62         extractOsmFilename("https?://.*/(.*\\.osm.(gz|bz2?|zip))", url);
     56        extractOsmFilename(PATTERN_COMPRESS, url);
    6357        return MainApplication.worker.submit(downloadTask);
    6458    }
  • trunk/src/org/openstreetmap/josm/gui/io/importexport/NoteImporter.java

    r13114 r13352  
    2020
    2121/**
    22  * File importer that reads note dump files (*.osn, .osn.gz and .osn.bz2)
     22 * File importer that reads note dump files (*.osn, .osn.gz, .osn.xz and .osn.bz2)
    2323 * @since 7538
    2424 */
  • trunk/src/org/openstreetmap/josm/gui/io/importexport/OsmExporter.java

    r12846 r13352  
    124124
    125125    protected void doSave(File file, OsmDataLayer layer) throws IOException {
    126         // create outputstream and wrap it with gzip or bzip, if necessary
     126        // create outputstream and wrap it with gzip, xz or bzip, if necessary
    127127        try (
    128128            OutputStream out = getOutputStream(file);
  • trunk/src/org/openstreetmap/josm/gui/io/importexport/OsmImporter.java

    r12671 r13352  
    3333     */
    3434    public static final ExtensionFileFilter FILE_FILTER = ExtensionFileFilter.newFilterWithArchiveExtensions(
    35             "osm,xml", "osm", tr("OSM Server Files") + " (*.osm, *.osm.gz, *.osm.bz2, *.osm.zip, *.xml)",
    36             ExtensionFileFilter.AddArchiveExtension.NONE, Arrays.asList("gz", "bz", "bz2", "zip"));
     35            "osm,xml", "osm", tr("OSM Server Files") + " (*.osm, *.osm.gz, *.osm.bz2, *.osm.xz, *.osm.zip, *.xml)",
     36            ExtensionFileFilter.AddArchiveExtension.NONE, Arrays.asList("gz", "bz", "bz2", "xz", "zip"));
    3737
    3838    /**
  • 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
  • trunk/test/unit/org/openstreetmap/josm/actions/ExtensionFileFilterTest.java

    r13079 r13352  
    99
    1010import nl.jqno.equalsverifier.EqualsVerifier;
    11 import nl.jqno.equalsverifier.Warning;
    1211
    1312/**
     
    3130    public void testNewFilterWithArchiveExtensions() {
    3231        test("ext1", "ext1", "description", true,
    33                 "ext1,ext1.gz,ext1.bz2", "description (*.ext1, *.ext1.gz, *.ext1.bz2)");
     32                "ext1,ext1.gz,ext1.bz,ext1.bz2,ext1.xz,ext1.zip",
     33                "description (*.ext1, *.ext1.gz, *.ext1.bz, *.ext1.bz2, *.ext1.xz, *.ext1.zip)");
    3434        test("ext1", "ext1", "description", false,
    35                 "ext1,ext1.gz,ext1.bz2", "description (*.ext1)");
     35                "ext1,ext1.gz,ext1.bz,ext1.bz2,ext1.xz,ext1.zip", "description (*.ext1)");
    3636        test("ext1,ext2", "ext1", "description", true,
    37                 "ext1,ext1.gz,ext1.bz2,ext2,ext2.gz,ext2.bz2", "description (*.ext1, *.ext1.gz, *.ext1.bz2, *.ext2, *.ext2.gz, *.ext2.bz2)");
     37                "ext1,ext1.gz,ext1.bz,ext1.bz2,ext1.xz,ext1.zip,ext2,ext2.gz,ext2.bz,ext2.bz2,ext2.xz,ext2.zip",
     38                "description (*.ext1, *.ext1.gz, *.ext1.bz, *.ext1.bz2, *.ext1.xz, *.ext1.zip, " +
     39                             "*.ext2, *.ext2.gz, *.ext2.bz, *.ext2.bz2, *.ext2.xz, *.ext2.zip)");
    3840        test("ext1,ext2", "ext1", "description", false,
    39                 "ext1,ext1.gz,ext1.bz2,ext2,ext2.gz,ext2.bz2", "description (*.ext1, *.ext2)");
     41                "ext1,ext1.gz,ext1.bz,ext1.bz2,ext1.xz,ext1.zip,ext2,ext2.gz,ext2.bz,ext2.bz2,ext2.xz,ext2.zip",
     42                "description (*.ext1, *.ext2)");
    4043    }
    4144
     
    4750        TestUtils.assumeWorkingEqualsVerifier();
    4851        EqualsVerifier.forClass(ExtensionFileFilter.class).usingGetClass()
    49             .suppress(Warning.ANNOTATION) // FIXME: remove it after https://github.com/jqno/equalsverifier/issues/152 is fixed
    5052            .verify();
    5153    }
Note: See TracChangeset for help on using the changeset viewer.