Protocol Buffers - Google's data interchange format
===================================================
[![Build Status](https://travis-ci.org/google/protobuf.svg?branch=master)](https://travis-ci.org/google/protobuf)
Copyright 2008 Google Inc.
This directory contains the Java Protocol Buffers Nano runtime library.
Installation - With Maven
-------------------------
The Protocol Buffers build is managed using Maven. If you would
rather build without Maven, see below.
1) Install Apache Maven if you don't have it:
http://maven.apache.org/
2) Build the C++ code, or obtain a binary distribution of protoc. If
you install a binary distribution, make sure that it is the same
version as this package. If in doubt, run:
$ protoc --version
You will need to place the protoc executable in ../src. (If you
built it yourself, it should already be there.)
3) Run the tests:
$ mvn test
If some tests fail, this library may not work correctly on your
system. Continue at your own risk.
4) Install the library into your Maven repository:
$ mvn install
5) If you do not use Maven to manage your own build, you can build a
.jar file to use:
$ mvn package
The .jar will be placed in the "target" directory.
Installation - Without Maven
----------------------------
If you would rather not install Maven to build the library, you may
follow these instructions instead. Note that these instructions skip
running unit tests.
1) Build the C++ code, or obtain a binary distribution of protoc. If
you install a binary distribution, make sure that it is the same
version as this package. If in doubt, run:
$ protoc --version
If you built the C++ code without installing, the compiler binary
should be located in ../src.
2) Invoke protoc to build DescriptorProtos.java:
$ protoc --java_out=src/main/java -I../src \
../src/google/protobuf/descriptor.proto
3) Compile the code in src/main/java using whatever means you prefer.
4) Install the classes wherever you prefer.
Nano version
------------
JavaNano is a special code generator and runtime library designed specially for
resource-restricted systems, like Android. It is very resource-friendly in both
the amount of code and the runtime overhead. Here is an overview of JavaNano
features compared with the official Java protobuf:
- No descriptors or message builders.
- All messages are mutable; fields are public Java fields.
- For optional fields only, encapsulation behind setter/getter/hazzer/
clearer functions is opt-in, which provide proper 'has' state support.
- For proto2, if not opted in, has state (field presence) is not available.
Serialization outputs all fields not equal to their defaults
(see important implications below).
The behavior is consistent with proto3 semantics.
- Required fields (proto2 only) are always serialized.
- Enum constants are integers; protection against invalid values only
when parsing from the wire.
- Enum constants can be generated into container interfaces bearing
the enum's name (so the referencing code is in Java style).
- CodedInputByteBufferNano can only take byte[] (not InputStream).
- Similarly CodedOutputByteBufferNano can only write to byte[].
- Repeated fields are in arrays, not ArrayList or Vector. Null array
elements are allowed and silently ignored.
- Full support for serializing/deserializing repeated packed fields.
- Support extensions (in proto2).
- Unset messages/groups are null, not an immutable empty default
instance.
- toByteArray(...) and mergeFrom(...) are now static functions of
MessageNano.
- The 'bytes' type translates to the Java type byte[].
The generated messages are not thread-safe for writes, but may be
used simultaneously from multiple threads in a read-only manner.
In other words, an appropriate synchronization mechanism (such as
a ReadWriteLock) must be used to ensure that a message, its
ancestors, and descendants are not accessed by any other threads
while the message is being modified. Field reads, getter methods
(but not getExtension(...)), toByteArray(...), writeTo(...),
getCachedSize(), and getSerializedSize() are all considered read-only
operations.
IMPORTANT: If you have fields with defaults and opt out of accessors
How fields with defaults are serialized has changed. Because we don't
keep "has" state, any field equal to its default is assumed to be not
set and therefore is not serialized. Consider the situation where we
change the default value of a field. Senders compiled against an older
version of the proto continue to match against the old default, and
don't send values to the receiver even though the receiver assumes the
new default value. Therefore, think carefully about the implications
of changing the default value. Alternatively, turn on accessors and
enjoy the benefit of the explicit has() checks.
IMPORTANT: If you have "bytes" fields with non-empty defaults
Because the byte buffer is now of mutable type byte[], the default
static final cannot be exposed through a public field. Each time a
message's constructor or clear() function is called, the default value
(kept in a private byte[]) is cloned. This causes a small memory
penalty. This is not a problem if the field has no default or is an
empty default.
Nano Generator options
----------------------
```
java_package -> <file-name>|<package-name>
java_outer_classname -> <file-name>|<package-name>
java_multiple_files -> true or false
java_nano_generate_has -> true or false [DEPRECATED]
optional_field_style -> default or accessors
enum_style -> c or java
ignore_services -> true or false
parcelable_messages -> true or false
generate_intdefs -> true or false
```
**java_package=\<file-name\>|\<package-name\>** (no default)
This allows overriding the 'java_package' option value
for the given file from the command line. Use multiple
java_package options to override the option for multiple
files. The final Java package for each file is the value
of this command line option if present, or the value of
the same option defined in the file if present, or the
proto package if present, or the default Java package.
**java_outer_classname=\<file-name\>|\<outer-classname\>** (no default)
This allows overriding the 'java_outer_classname' option
for the given file from the command line. Use multiple
java_outer_classname options to override the option for
multiple files. The final Java outer class name for each
file is the value of this command line option if present,
or the value of the same option defined in the file if
present, or the file name converted to CamelCase. This
outer class will nest all classes and integer constants
generated from file-scope messages and enums.
**java_multiple_files={true,false}** (no default)
This allows overriding the 'java_multiple_files' option
in all source files and their imported files from the
command line. The final value of this option for each
file is the value defined in this command line option, or
the value of the same option defined in the file if
present, or false. This specifies whether to generate
package-level classes for the file-scope messages in the
same Java package as the outer class (instead of nested
classes in the outer class). File-scope enum constants
are still generated as integer constants in the outer
class. This affects the fully qualified references in the
Java code. NOTE: because the command line option
overrides the value for all files and their imported
files, using this option inconsistently may result in
incorrect references to the imported messages and enum
constants.
**java_nano_generate_has={true,false}** (default: false)
DEPRECATED. Use optional_field_style=accessors.
If true, generates a public boolean variable has\<fieldname\>
accompanying each optional or required field (not present for
repeated fiel
没有合适的资源?快使用搜索试试~ 我知道了~
protobuf-3.0.0-alpha-3.1
共1417个文件
cc:282个
h:277个
cs:192个
4星 · 超过85%的资源 需积分: 13 22 下载量 24 浏览量
2016-08-17
16:41:52
上传
评论
收藏 7.17MB ZIP 举报
温馨提示
安装protobuf各个版本的编译代码,从protobuf-2.4.1到protobuf-3.0.0-Release之间的20个版本,在Mac上protobuf-2.6.1、protobuf-3.0.0-alpha-1、protobuf-3.0.0-beta-2、protobuf-3.0.0测试全部成功!解决了从GitHub上下载安装执行./autogen.sh失败的问题!
资源推荐
资源详情
资源评论
收起资源包目录
protobuf-3.0.0-alpha-3.1 (1417个子文件)
output.0 582KB
traces.0 135KB
output.1 582KB
traces.1 40KB
configure.ac 5KB
configure.ac 3KB
Makefile.am 61KB
Makefile.am 38KB
Makefile.am 10KB
Makefile.am 2KB
ar-lib 6KB
bad_utf8_string 3B
extract_includes.bat 9KB
build.bat 719B
BuildAll.bat 344B
generate_new_key.bat 296B
RunBenchmarks.bat 163B
upb.c 389KB
defs.c 56KB
encode_decode.c 40KB
storage.c 28KB
map.c 25KB
repeated_field.c 21KB
message.c 18KB
protobuf.c 5KB
gtest.cbproj 10KB
gtest_unittest.cbproj 8KB
gtest_main.cbproj 8KB
descriptor.pb.cc 517KB
gtest-all.cc 346KB
gtest_unittest.cc 234KB
descriptor.cc 229KB
descriptor_unittest.cc 225KB
gtest.cc 180KB
test_util.cc 180KB
cpp_message.cc 128KB
parser_unittest.cc 101KB
type.pb.cc 95KB
message.cc 92KB
test_util_lite.cc 89KB
map_test.cc 80KB
generated_message_reflection.cc 78KB
gtest_pred_impl_unittest.cc 76KB
wrappers.pb.cc 73KB
extension_set.cc 72KB
cpp_unittest.cc 71KB
parser.cc 67KB
text_format.cc 65KB
plugin.pb.cc 62KB
command_line_interface.cc 61KB
map_test_util.cc 56KB
command_line_interface_unittest.cc 56KB
descriptor.cc 52KB
text_format_unittest.cc 52KB
strutil.cc 51KB
python_generator.cc 51KB
gtest-death-test.cc 50KB
extension_set_unittest.cc 49KB
api.pb.cc 49KB
gtest-printers_test.cc 48KB
descriptor_containers.cc 48KB
coded_stream_unittest.cc 47KB
struct.pb.cc 45KB
arena_unittest.cc 44KB
java_message.cc 44KB
java_message_field.cc 44KB
repeated_field_unittest.cc 44KB
gtest-death-test_test.cc 42KB
wire_format.cc 42KB
wire_format_unittest.cc 41KB
java_message_lite.cc 40KB
java_string_field.cc 38KB
gtest-port_test.cc 38KB
tokenizer_unittest.cc 37KB
tokenizer.cc 36KB
java_string_field_lite.cc 36KB
objectivec_helpers.cc 35KB
csharp_message.cc 34KB
java_enum_field.cc 34KB
java_enum_field_lite.cc 34KB
javanano_primitive_field.cc 34KB
cpp_string_field.cc 34KB
java_message_field_lite.cc 33KB
gtest-param-test_test.cc 33KB
gtest_output_test_.cc 32KB
java_primitive_field_lite.cc 31KB
generated_message_reflection_unittest.cc 31KB
zero_copy_stream_unittest.cc 30KB
java_primitive_field.cc 30KB
dynamic_message.cc 30KB
repeated_field_reflection_unittest.cc 29KB
coded_stream.cc 28KB
cpp_file.cc 28KB
java_lazy_message_field.cc 27KB
extension_set_heavy.cc 27KB
gtest-port.cc 27KB
lite_unittest.cc 26KB
repeated_scalar_container.cc 26KB
cpp_message_field.cc 25KB
objectivec_message.cc 25KB
共 1417 条
- 1
- 2
- 3
- 4
- 5
- 6
- 15
资源评论
- 键盘手老张2016-11-01可以的,真的不错
- lanbest2016-10-31不错,比较好用
一只小小加菲猫
- 粉丝: 9
- 资源: 23
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 各种排序算法java实现的源代码.zip
- 金山PDF教育版编辑器
- 基于springboot+element的校园服务平台源代码项目包含全套技术资料.zip
- 自动化应用驱动的容器弹性管理平台解决方案
- 各种排序算法 Python 实现的源代码
- BlurAdmin 是一款使用 AngularJs + Bootstrap实现的单页管理端模版,视觉冲击极强的管理后台,各种动画效果
- 基于JSP+Servlet的网上书店系统源代码项目包含全套技术资料.zip
- GGJGJGJGGDGGDGG
- 基于SpringBoot的毕业设计选题系统源代码项目包含全套技术资料.zip
- Springboot + mybatis-plus + layui 实现的博客系统源代码全套技术资料.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功