source: josm/trunk/src/org/openstreetmap/josm/io/OsmBzip2Importer.java@ 2702

Last change on this file since 2702 was 2070, checked in by Gubaer, 15 years ago

new: rewrite of CombineWay action
new: conflict resolution dialog for CombineWay, including conflicts for different relation memberships
cleanup: cleanup in OsmReader, reduces memory footprint and reduces parsing time
cleanup: made most of the public fields in OsmPrimitive @deprecated, added accessors and changed the code
cleanup: replaced usages of @deprecated constructors for ExtendedDialog
fixed #3208: Combine ways brokes relation order

WARNING: this changeset touches a lot of code all over the code base. "latest" might become slightly unstable in the next days. Also experience incompatibility issues with plugins in the next few days.

File size: 1.1 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.io;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5
6import java.io.BufferedInputStream;
7import java.io.File;
8import java.io.FileInputStream;
9import java.io.IOException;
10
11import org.apache.tools.bzip2.CBZip2InputStream;
12import org.openstreetmap.josm.actions.ExtensionFileFilter;
13
14public class OsmBzip2Importer extends OsmImporter {
15
16 public OsmBzip2Importer() {
17 super(new ExtensionFileFilter("osm.bz2,osm.bz", "osm.bz2", tr("OSM Server Files bzip2 compressed")
18 + " (*.osm.bz2 *.osm.bz)"));
19 }
20
21 @Override
22 public void importData(File file) throws IOException, IllegalDataException {
23 BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file));
24 int b = bis.read();
25 if (b != 'B')
26 throw new IOException(tr("Invalid bz2 file."));
27 b = bis.read();
28 if (b != 'Z')
29 throw new IOException(tr("Invalid bz2 file."));
30 CBZip2InputStream in = new CBZip2InputStream(bis);
31 importData(in, file);
32 }
33}
Note: See TracBrowser for help on using the repository browser.