Changeset 13350 in josm for trunk/src/org
- Timestamp:
- 2018-01-21T22:05:06+01:00 (7 years ago)
- Location:
- trunk/src/org
- Files:
-
- 112 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/ExtensionFileFilter.java
r13329 r13350 410 410 String extensions, String defaultExtension, String description, boolean addArchiveExtensionsToDescription) { 411 411 412 List<String> archiveExtensions = Arrays.asList("gz", "bz 2");412 List<String> archiveExtensions = Arrays.asList("gz", "bz", "bz2", "xz", "zip"); 413 413 return newFilterWithArchiveExtensions( 414 414 extensions, -
trunk/src/org/openstreetmap/josm/io/Compression.java
r13204 r13350 16 16 import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream; 17 17 import org.apache.commons.compress.compressors.bzip2.BZip2CompressorOutputStream; 18 import org.apache.commons.compress.compressors.xz.XZCompressorInputStream; 19 import org.apache.commons.compress.compressors.xz.XZCompressorOutputStream; 18 20 import org.openstreetmap.josm.tools.Logging; 19 21 import org.openstreetmap.josm.tools.Utils; … … 38 40 * zip compression 39 41 */ 40 ZIP; 42 ZIP, 43 /** 44 * xz compression 45 */ 46 XZ; 41 47 42 48 /** … … 52 58 : name != null && name.endsWith(".zip") 53 59 ? ZIP 60 : name != null && name.endsWith(".xz") 61 ? XZ 54 62 : NONE; 55 63 } … … 68 76 case "application/x-bzip2": 69 77 return BZIP2; 78 case "application/x-xz": 79 return XZ; 70 80 default: 71 81 return NONE; … … 88 98 case ZIP: 89 99 return getZipInputStream(in); 100 case XZ: 101 return getXZInputStream(in); 90 102 case NONE: 91 103 default: 92 104 return in; 93 105 } 106 } 107 108 /** 109 * Returns a XZ input stream wrapping given input stream. 110 * @param in The raw input stream 111 * @return a XZ input stream wrapping given input stream, or {@code null} if {@code in} is {@code null} 112 * @throws IOException if the given input stream does not contain valid BZ2 header 113 * @since 13350 114 */ 115 public static XZCompressorInputStream getXZInputStream(InputStream in) throws IOException { 116 if (in == null) { 117 return null; 118 } 119 return new XZCompressorInputStream(in, true); 94 120 } 95 121 … … 173 199 case ZIP: 174 200 return new ZipOutputStream(out, StandardCharsets.UTF_8); 201 case XZ: 202 return new XZCompressorOutputStream(out); 175 203 case NONE: 176 204 default:
Note:
See TracChangeset
for help on using the changeset viewer.