use of de.topobyte.osm4j.pbf.seq.PbfParser in project osm4j-pbf by topobyte.
the class Util method read.
public static void read(File file, boolean fetchMetadata) throws IOException {
InputStream input = new FileInputStream(file);
PbfParser parser = new PbfParser(nullHandler, fetchMetadata);
parser.parse(input);
input.close();
}
use of de.topobyte.osm4j.pbf.seq.PbfParser in project osm4j-pbf by topobyte.
the class CopyElementwise method main.
public static void main(String[] args) throws IOException, OsmInputException {
if (args.length != 2) {
System.out.println("usage: " + CopyElementwise.class.getSimpleName() + " <input> <output>");
System.exit(1);
}
InputStream input = new FileInputStream(args[0]);
OutputStream output = new FileOutputStream(args[1]);
final PbfWriter writer = new PbfWriter(output, true);
PbfParser parser = new PbfParser(new OsmHandler() {
@Override
public void handle(OsmBounds bounds) throws IOException {
writer.write(bounds);
}
@Override
public void handle(OsmNode node) throws IOException {
writer.write(node);
}
@Override
public void handle(OsmWay way) throws IOException {
writer.write(way);
}
@Override
public void handle(OsmRelation relation) throws IOException {
writer.write(relation);
}
@Override
public void complete() throws IOException {
writer.complete();
}
}, true);
parser.parse(input);
output.close();
}
use of de.topobyte.osm4j.pbf.seq.PbfParser in project osm4j-pbf by topobyte.
the class TestCountCallback method main.
public static void main(String[] args) throws IOException {
if (args.length != 1) {
System.out.println("usage: " + TestCountCallback.class.getSimpleName() + " <filename>");
System.exit(1);
}
File file = new File(args[0]);
TestCountCallback test = new TestCountCallback();
PbfParser parser = new PbfParser(test, false);
FileInputStream input = new FileInputStream(file);
parser.parse(input);
}
use of de.topobyte.osm4j.pbf.seq.PbfParser in project osm4j-pbf by topobyte.
the class Util method read.
public static void read(String resource, boolean fetchMetadata) throws IOException {
InputStream input = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource);
PbfParser parser = new PbfParser(nullHandler, fetchMetadata);
parser.parse(input);
input.close();
}
Aggregations