Changeset 29008 in osm for applications/editors/josm/plugins/opendata/src/org
- Timestamp:
- 2012-11-29T01:25:24+01:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/tabular/CsvImporter.java
r28000 r29008 16 16 package org.openstreetmap.josm.plugins.opendata.core.io.tabular; 17 17 18 import java.io.BufferedReader; 19 import java.io.File; 20 import java.io.FileReader; 18 21 import java.io.IOException; 19 22 import java.io.InputStream; … … 25 28 26 29 public class CsvImporter extends AbstractImporter { 30 31 public static final String COLOMBUS_HEADER = "INDEX,TAG,DATE,TIME,LATITUDE N/S,LONGITUDE E/W,HEIGHT,SPEED,HEADING,FIX MODE,VALID,PDOP,HDOP,VDOP,VOX"; 27 32 28 33 public CsvImporter() { … … 39 44 } 40 45 } 46 47 @Override 48 public boolean acceptFile(File pathname) { 49 return super.acceptFile(pathname) && !isColombusCsv(pathname); 50 } 51 52 public static boolean isColombusCsv(File file) { 53 boolean result = false; 54 if (file != null && file.isFile()) { 55 try { 56 BufferedReader reader = new BufferedReader(new FileReader(file)); 57 try { 58 String line = reader.readLine(); 59 result = line != null && line.equalsIgnoreCase(COLOMBUS_HEADER); 60 } finally { 61 reader.close(); 62 } 63 } catch (IOException e) { 64 // Ignore exceptions 65 } 66 } 67 return result; 68 } 41 69 }
Note:
See TracChangeset
for help on using the changeset viewer.