Iterator<EntityContainer> nodes = getFeatures(ref + ":node");
Iterator<EntityContainer> ways = getFeatures(ref + ":way");
Iterator<EntityContainer> iterator = Iterators.concat(nodes, ways);
if (file.getName().endsWith(".pbf")) {
BlockOutputStream output = new BlockOutputStream(new FileOutputStream(file));
OsmosisSerializer serializer = new OsmosisSerializer(output);
while (iterator.hasNext()) {
EntityContainer entity = iterator.next();
serializer.process(entity);
}
serializer.complete();
} else {
XmlWriter writer = new XmlWriter(file, CompressionMethod.None);
while (iterator.hasNext()) {
EntityContainer entity = iterator.next();
writer.process(entity);