Protobuf 2.6.0 发布,此版本现已提供下载,更新内容如下:
常规更新添加 oneofs(unions) 功能。Fields in the same oneof will share memory and at most one field can be set at the same time. Use the oneof keyword to define a oneof like: message SampleMessage {
oneof test_oneof {
string name = 4;
YourMessage sub_message = 9;
}
} Files, services, enums, messages, methods and enum values can be marked as deprecated now. 解析 Java 和 C++ 文本格式 protos 时, 添加对 list values 的支持,包括 lists of messages For example: foo: [1, 2, 3]
C++Enhanced customization on TestFormat printing. Added SwapFields() in reflection API to swap a subset of fields. Added SetAllocatedMessage() in reflection API. Repeated primitive extensions are now packable. The [packed=true] option only affects serializers. Therefore, it is possible to switch a repeated extension field to packed format without breaking backwards-compatibility. Various speed optimizations.
JavawriteTo() method in ByteString can now write a substring to an output stream. Added endWith() method for ByteString. ByteString and ByteBuffer are now supported in CodedInputStream and CodedOutputStream. java_generate_equals_and_hash can now be used with the LITE_RUNTIME.
Python
Protocol Buffers (ProtocolBuffer/ protobuf )是Google公司开发的一种数据描述语言,类似于XML能够将结构化数据序列化,可用于数据存储、通信协议等方面。现阶段支持C++、JAVA、Python等三种编程语言。 为什么不只用XML?同XML相比,Protocol buffers在序列化结构化数据方面有许多优点(google官方提出): 更简单 数据描述文件只需原来的1/10至1/3 解析速度是原来的20倍至100倍 减少了二义性 生成了更容易在编程中使用的数据访问类
google大概是今天(08年7月8号)将其作为开源项目对外公布,说是后续还要开源的项目有不少都会用到Protocol Buffers。 |