use of net.osmand.binary.OsmandOdb.MapDataBlock in project OsmAnd-tools by osmandapp.
the class BinaryMapIndexWriter method writeMapDataBlock.
public void writeMapDataBlock(MapDataBlock.Builder builder, Map<String, Integer> stringTable, BinaryFileReference ref) throws IOException {
checkPeekState(MAP_ROOT_LEVEL_INIT);
StringTable.Builder bs = OsmandOdb.StringTable.newBuilder();
if (stringTable != null) {
for (String s : stringTable.keySet()) {
bs.addS(s);
}
}
StringTable st = bs.build();
builder.setStringTable(st);
int size = st.getSerializedSize();
STRING_TABLE_SIZE += CodedOutputStream.computeTagSize(OsmandOdb.MapDataBlock.STRINGTABLE_FIELD_NUMBER) + CodedOutputStream.computeRawVarint32Size(size) + size;
codedOutStream.writeTag(OsmAndMapIndex.MapRootLevel.BLOCKS_FIELD_NUMBER, FieldType.MESSAGE.getWireType());
codedOutStream.flush();
ref.writeReference(raf, getFilePointer());
MapDataBlock block = builder.build();
MAP_DATA_SIZE += block.getSerializedSize();
codedOutStream.writeMessageNoTag(block);
}
Aggregations