Changeset 6882 in josm for trunk/src/org/openstreetmap/josm/io
- Timestamp:
- 2014-02-25T00:21:39+01:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/io
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
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.