Changeset 8894 in josm
- Timestamp:
- 2015-10-18T12:48:44+02:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/ExtensionFileFilter.java
r8813 r8894 5 5 import java.util.ArrayList; 6 6 import java.util.Arrays; 7 import java.util.Collection; 7 8 import java.util.Collections; 8 9 import java.util.Comparator; 10 import java.util.LinkedHashSet; 9 11 import java.util.LinkedList; 10 12 import java.util.List; … … 279 281 280 282 /** 283 * Construct an extension file filter with the extensions supported by {@link org.openstreetmap.josm.io.Compression} 284 * automatically added to the {@code extensions}. The specified {@code extensions} will be added to the description 285 * in the form {@code old-description (*.ext1, *.ext2)}. 286 * @param extensions The comma-separated list of file extensions 287 * @param defaultExtension The default extension 288 * @param description A short textual description of the file type without supported extensions in parentheses 289 * @return The constructed filter 290 */ 291 public static ExtensionFileFilter newFilterWithArchiveExtensions(String extensions, String defaultExtension, String description) { 292 final Collection<String> extensionsPlusArchive = new LinkedHashSet<>(); 293 final Collection<String> extensionsForDescription = new LinkedHashSet<>(); 294 for (String e : extensions.split(",")) { 295 extensionsPlusArchive.add(e); 296 extensionsPlusArchive.add(e + ".gz"); 297 extensionsPlusArchive.add(e + ".bz2"); 298 extensionsForDescription.add("*." + e); 299 // intentionally do not add [e].gz and [e].bz2 to extensionsForDescription in order to avoid long texts 300 } 301 return new ExtensionFileFilter(Utils.join(",", extensionsPlusArchive), defaultExtension, 302 description + " (" + Utils.join(", ", extensionsForDescription) + ")"); 303 } 304 305 /** 281 306 * Returns true if this file filter accepts the given filename. 282 307 * @param filename The filename to check after -
trunk/src/org/openstreetmap/josm/io/NMEAImporter.java
r8390 r8894 5 5 6 6 import java.io.File; 7 import java.io.FileInputStream;8 7 import java.io.IOException; 9 8 import java.io.InputStream; … … 31 30 * The NMEA file filter (*.nmea *.nme *.nma *.log *.txt files). 32 31 */ 33 public static final ExtensionFileFilter FILE_FILTER = new ExtensionFileFilter(34 "nmea,nme,nma,log,txt", "nmea", tr("NMEA-0183 Files") + " (*.nmea *.nme *.nma *.log *.txt)");32 public static final ExtensionFileFilter FILE_FILTER = ExtensionFileFilter.newFilterWithArchiveExtensions( 33 "nmea,nme,nma,log,txt", "nmea", tr("NMEA-0183 Files")); 35 34 36 35 /** … … 44 43 public void importData(File file, ProgressMonitor progressMonitor) throws IOException { 45 44 final String fn = file.getName(); 46 try (InputStream fis = newFileInputStream(file)) {45 try (InputStream fis = Compression.getUncompressedFileInputStream(file)) { 47 46 final NmeaReader r = new NmeaReader(fis); 48 47 if (r.getNumberOfCoordinates() > 0) {
Note:
See TracChangeset
for help on using the changeset viewer.