- Timestamp:
- 2014-02-25T00:21:39+01:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/ExtensionFileFilter.java
r6380 r6882 48 48 "org.openstreetmap.josm.io.OsmImporter", 49 49 "org.openstreetmap.josm.io.OsmGzipImporter", 50 "org.openstreetmap.josm.io.OsmZipImporter", 50 51 "org.openstreetmap.josm.io.OsmChangeImporter", 51 52 "org.openstreetmap.josm.io.GpxImporter", -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmCompressedTask.java
r6798 r6882 19 19 public class DownloadOsmCompressedTask extends DownloadOsmTask { 20 20 21 static final String PATTERN_ GZ = "https?://.*/.*\\.osm.(gz|bz2?)";21 static final String PATTERN_COMPRESS = "https?://.*/.*\\.osm.(gz|bz2?|zip)"; 22 22 23 23 @Override 24 24 public String[] getPatterns() { 25 return new String[]{PATTERN_ GZ};25 return new String[]{PATTERN_COMPRESS}; 26 26 } 27 27 … … 31 31 } 32 32 33 /* (non-Javadoc)34 * @see org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask#download(boolean, org.openstreetmap.josm.data.Bounds, org.openstreetmap.josm.gui.progress.ProgressMonitor)35 */36 33 @Override 37 34 public Future<?> download(boolean newLayer, Bounds downloadArea, … … 54 51 if (url.matches("https?://.*/.*\\.osm.bz2?")) { 55 52 return reader.parseOsmBzip2(subTaskMonitor); 53 } else if (url.matches("https?://.*/.*\\.osm.gz")) { 54 return reader.parseOsmGzip(subTaskMonitor); 56 55 } else { 57 return reader.parseOsm Gzip(subTaskMonitor);56 return reader.parseOsmZip(subTaskMonitor); 58 57 } 59 58 } 60 59 }; 61 60 currentBounds = null; 62 // Extract .osm.gz/bz/bz2 filename from URL to set the new layer name63 extractOsmFilename("https?://.*/(.*\\.osm.(gz|bz2? ))", url);61 // Extract .osm.gz/bz/bz2/zip filename from URL to set the new layer name 62 extractOsmFilename("https?://.*/(.*\\.osm.(gz|bz2?|zip))", url); 64 63 return Main.worker.submit(downloadTask); 65 64 } -
trunk/src/org/openstreetmap/josm/io/Compression.java
r6716 r6882 13 13 import java.net.URL; 14 14 import java.util.zip.GZIPOutputStream; 15 import java.util.zip.ZipOutputStream; 15 16 16 17 /** … … 29 30 * gzip compression 30 31 */ 31 GZIP; 32 GZIP, 33 /** 34 * zip compression 35 */ 36 ZIP; 32 37 33 38 /** 34 39 * Determines the compression type depending on the suffix of {@code name}. 40 * @param name File name including extension 41 * @return the compression type 35 42 */ 36 43 public static Compression byExtension(String name) { … … 39 46 : name != null && (name.endsWith(".bz2") || name.endsWith(".bz")) 40 47 ? BZIP2 48 : name != null && name.endsWith(".zip") 49 ? ZIP 41 50 : NONE; 42 51 } … … 53 62 case GZIP: 54 63 return FileImporter.getGZipInputStream(in); 64 case ZIP: 65 return FileImporter.getZipInputStream(in); 55 66 case NONE: 56 67 default: … … 90 101 case GZIP: 91 102 return new GZIPOutputStream(out); 103 case ZIP: 104 return new ZipOutputStream(out); 92 105 case NONE: 93 106 default: -
trunk/src/org/openstreetmap/josm/io/FileImporter.java
r6830 r6882 10 10 import java.util.List; 11 11 import java.util.zip.GZIPInputStream; 12 import java.util.zip.ZipEntry; 13 import java.util.zip.ZipInputStream; 12 14 13 15 import javax.swing.JOptionPane; … … 156 158 } 157 159 160 public static ZipInputStream getZipInputStream(InputStream in) throws IOException { 161 if (in == null) { 162 return null; 163 } 164 ZipInputStream zis = new ZipInputStream(in); 165 // Positions the stream at the beginning of first entry 166 ZipEntry ze = zis.getNextEntry(); 167 if (ze != null && Main.isDebugEnabled()) { 168 Main.debug("Zip entry: "+ze.getName()); 169 } 170 return zis; 171 } 172 158 173 /** 159 174 * Returns the enabled state of this {@code FileImporter}. When enabled, it is listed and usable in "File->Open" dialog. -
trunk/src/org/openstreetmap/josm/io/OsmServerLocationReader.java
r6803 r6882 77 77 78 78 @Override 79 public DataSet parseOsmZip(final ProgressMonitor progressMonitor) throws OsmTransferException { 80 return doParse(new OsmParser(progressMonitor, Compression.ZIP), progressMonitor); 81 } 82 83 @Override 79 84 public DataSet parseOsmChange(final ProgressMonitor progressMonitor) throws OsmTransferException { 80 85 return doParse(new OsmChangeParser(progressMonitor, Compression.NONE), progressMonitor); -
trunk/src/org/openstreetmap/josm/io/OsmServerReader.java
r6852 r6882 303 303 304 304 /** 305 * Download Zip-compressed OSM files from somewhere 306 * @param progressMonitor The progress monitor 307 * @return The corresponding dataset 308 * @throws OsmTransferException if any error occurs 309 * @since 6882 310 */ 311 public DataSet parseOsmZip(final ProgressMonitor progressMonitor) throws OsmTransferException { 312 return null; 313 } 314 315 /** 305 316 * Returns true if this reader is adding authentication credentials to the read 306 317 * request sent to the server.
Note:
See TracChangeset
for help on using the changeset viewer.