Changeset 5361 in josm for trunk/src/org/openstreetmap/josm/io/FileImporter.java
- Timestamp:
- 2012-07-25T02:31:52+02:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/FileImporter.java
r3679 r5361 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.io.BufferedInputStream; 6 7 import java.io.File; 7 8 import java.io.IOException; 9 import java.io.InputStream; 8 10 import java.util.List; 11 import java.util.zip.GZIPInputStream; 9 12 10 13 import javax.swing.JOptionPane; 11 14 15 import org.apache.tools.bzip2.CBZip2InputStream; 12 16 import org.openstreetmap.josm.Main; 13 17 import org.openstreetmap.josm.actions.ExtensionFileFilter; … … 97 101 return (new Double(this.getPriority())).compareTo(other.getPriority()); 98 102 } 103 104 public static CBZip2InputStream getBZip2InputStream(InputStream in) throws IOException { 105 if (in == null) { 106 return null; 107 } 108 BufferedInputStream bis = new BufferedInputStream(in); 109 int b = bis.read(); 110 if (b != 'B') 111 throw new IOException(tr("Invalid bz2 file.")); 112 b = bis.read(); 113 if (b != 'Z') 114 throw new IOException(tr("Invalid bz2 file.")); 115 return new CBZip2InputStream(bis); 116 } 99 117 118 public static GZIPInputStream getGZipInputStream(InputStream in) throws IOException { 119 if (in == null) { 120 return null; 121 } 122 return new GZIPInputStream(in); 123 } 100 124 }
Note:
See TracChangeset
for help on using the changeset viewer.