0

我想将 IO 头移动到某个 CodedOutputStream 或 ZeroCopyOutputStream 的开头,以便我可以使用文件中有多少 protobuf 消息以及以下消息消耗多少字节来更新标头数据结构。

备份功能不适用于此,有什么建议吗?我正在为事件数据创建文件格式,其中每个文件包含多个事件数据集。为此,我需要 2 种类型的标题实体(固定大小),一种是全局的,另一种是每个数据集的。我在写入数据集事件后更新这些。那么,如何在不破坏流对象内部状态的情况下移动写入标头?

编辑

我想知道,如果我刷新流包装器并仅使用 c 函数来重新安装头部,这是否适用于流类,或者我最终会进入未定义的土地?

4

1 回答 1

1

I guess the most obvious way would be to have two files instead of each one: The main file with the streamed data, and then an index file with the header information.

于 2012-04-10T15:19:06.477 回答