Java: pbf Stream instead of Reader

I’m currently using my own implementation of

in combination with

to extract the nodes I want from the latest planet.osm.pbf file.

My application is not time-critical, but as the OsmosisReader reads & processes the file completely first, before invoking the process method on each node, I think my pc will run out of RAM once I switch from one of the smaller files to the actual planet map.

You can inspect my project on GitHub @ https://raw.githubusercontent.com/scrouthtv/DataIsBeautiful/master/src/utils/PbfReader.java.

Is it possible to use some kind of Pbf Stream instead of the OsmosisReader with which I can process every tag parallely to the decompression of the file?

Thank you in advance :slight_smile:

You may have a look at splitter or mkgmap (1) or the pbf plugin for JOSM. They all use osm-pbf.jar

(1) http://www.mkgmap.org.uk/