Techniques 中文翻译(Google Protocol Buffers中文教程)

本文是Google Protocol Buffers的中文翻译教程,涵盖了流式处理多个消息、处理大数据集、联合类型和自描述消息等技巧。教程介绍了如何在处理Protocol Buffers时解决这些问题,并提供了使用示例。
摘要由CSDN通过智能技术生成

NULL

完整文章,请查看:http://www.codelast.com/?p=316

 

Techniques 技巧

注:这是 本人的翻译,可能不准确,可能有错误,但是基本上可以理解,希望能对大家有所帮助!(转载请注明出处:本文来自learnhard的博客:http://www.codelast.com/ & http://blog.csdn.net/learnhard/


·         Streaming Multiple Messages

·         Large Data Sets

·         Union Types

·         Self-describing Messages

This page describes some commonly-used design patterns for dealing with Protocol Buffers. You can also send design and usage questions to the Protocol Buffers discussion group.

 

l  将多个消息转化为流

l  大数据集

l  联合类型

l  自描述的消息

本文描述了处理Protocol Buffers的时候一些常用的设计模式。你也可以向Protocol Buffers讨论组(Protocol Buffers discussion group)发送设计和使用方面的问题寻求解答。

 

Streaming Multiple Messages 将多个消息转化为流

If you want to write multiple messages to a single file or stream, it is up to you to keep track of where one message ends and the next begins. The Protocol Buffer wire format is not self-delimiting, so protocol buffer parsers cannot determine where a message ends on their own. The easiest way to solve this problem is to write the size of each message before you write the message itself. When you read the messages back in, you read the size, then read the bytes into a separate buffer, then parse from that buffer. (If you want to avoid copying bytes to a separate buffer, check out the 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值