package com.xiaopeng.map.utils;
|
|
/**
|
* 将 MapAreaVersion 序列化为与 map_area_version.proto 兼容的 Protobuf 文本格式(text proto)。
|
* 与 C++ xngp_area_fbs_convertor 的 DebugString() 输出一致,供 xngp_area_queryer 使用 TextFormat 解析。
|
* 使用平台默认编码(非 UTF-8 强制指定),与 C++ 读取端编码保持一致。
|
*/
|
public final class MapAreaVersionProtoWriter {
|
|
private MapAreaVersionProtoWriter() {
|
}
|
|
/**
|
* 生成 MapAreaVersion 的 text proto 格式,与 C++ DebugString() 输出一致。
|
*
|
* @param version Unix 秒级时间戳
|
* @param fileLength bin 文件字节长度
|
* @return text proto 字节(平台默认编码)
|
*/
|
public static byte[] toByteArray(int version, int fileLength) {
|
String text = "version: " + version + "\nfile_length: " + fileLength + "\n";
|
return text.getBytes();
|
}
|
}
|