protoc 2.6.1.1 → 2.6.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/protoc/Makefile.in +10 -13
- data/ext/protoc/extconf.rb +0 -1
- data/ext/protoc/protobuf/CHANGES.txt +593 -0
- data/ext/protoc/protobuf/CONTRIBUTORS.txt +93 -0
- data/ext/protoc/protobuf/INSTALL.txt +237 -0
- data/ext/protoc/protobuf/LICENSE +33 -0
- data/ext/protoc/protobuf/Makefile.am +267 -0
- data/ext/protoc/protobuf/README.md +167 -0
- data/ext/protoc/protobuf/autogen.sh +41 -0
- data/ext/protoc/protobuf/benchmarks/ProtoBench.java +203 -0
- data/ext/protoc/protobuf/benchmarks/google_message1.dat +0 -0
- data/ext/protoc/protobuf/benchmarks/google_message2.dat +0 -0
- data/ext/protoc/protobuf/benchmarks/google_size.proto +136 -0
- data/ext/protoc/protobuf/benchmarks/google_speed.proto +136 -0
- data/ext/protoc/protobuf/benchmarks/readme.txt +50 -0
- data/ext/protoc/protobuf/configure.ac +159 -0
- data/ext/protoc/protobuf/editors/README.txt +5 -0
- data/ext/protoc/protobuf/editors/proto.vim +105 -0
- data/ext/protoc/protobuf/editors/protobuf-mode.el +220 -0
- data/ext/protoc/protobuf/examples/AddPerson.java +95 -0
- data/ext/protoc/protobuf/examples/ListPeople.java +50 -0
- data/ext/protoc/protobuf/examples/Makefile +58 -0
- data/ext/protoc/protobuf/examples/README.txt +29 -0
- data/ext/protoc/protobuf/examples/add_person.cc +95 -0
- data/ext/protoc/protobuf/examples/add_person.py +58 -0
- data/ext/protoc/protobuf/examples/addressbook.proto +30 -0
- data/ext/protoc/protobuf/examples/list_people.cc +68 -0
- data/ext/protoc/protobuf/examples/list_people.py +38 -0
- data/ext/protoc/protobuf/generate_descriptor_proto.sh +33 -0
- data/ext/protoc/protobuf/java/README.txt +96 -0
- data/ext/protoc/protobuf/java/pom.xml +217 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/AbstractMessage.java +466 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/AbstractMessageLite.java +355 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/AbstractParser.java +253 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/BlockingRpcChannel.java +51 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/BlockingService.java +64 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/BoundedByteString.java +163 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/ByteString.java +1022 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/CodedInputStream.java +1311 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/CodedOutputStream.java +1297 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Descriptors.java +2238 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/DynamicMessage.java +622 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Extension.java +96 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/ExtensionRegistry.java +392 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/ExtensionRegistryLite.java +185 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/FieldSet.java +907 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/GeneratedMessage.java +2213 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/GeneratedMessageLite.java +949 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Internal.java +391 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java +122 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/LazyField.java +154 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/LazyFieldLite.java +176 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/LazyStringArrayList.java +367 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/LazyStringList.java +163 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/LiteralByteString.java +362 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Message.java +244 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/MessageLite.java +320 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/MessageLiteOrBuilder.java +60 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/MessageOrBuilder.java +143 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/MessageReflection.java +931 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Parser.java +261 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/ProtocolMessageEnum.java +58 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/ProtocolStringList.java +48 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/RepeatedFieldBuilder.java +696 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/RopeByteString.java +957 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/RpcCallback.java +47 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/RpcChannel.java +71 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/RpcController.java +118 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/RpcUtil.java +134 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Service.java +117 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/ServiceException.java +52 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/SingleFieldBuilder.java +241 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/SmallSortedMap.java +618 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/TextFormat.java +1984 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/UninitializedMessageException.java +99 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/UnknownFieldSet.java +995 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/UnmodifiableLazyStringList.java +205 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Utf8.java +349 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/WireFormat.java +163 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/AbstractMessageTest.java +527 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/BoundedByteStringTest.java +68 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/ByteStringTest.java +759 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/CheckUtf8Test.java +141 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/CodedInputStreamTest.java +769 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/CodedOutputStreamTest.java +401 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/DeprecatedFieldTest.java +80 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/DescriptorsTest.java +735 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/DynamicMessageTest.java +326 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/ForceFieldBuildersPreRun.java +48 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/GeneratedMessageTest.java +1515 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/IsValidUtf8Test.java +180 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/IsValidUtf8TestUtil.java +421 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LazyFieldLiteTest.java +134 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LazyFieldTest.java +121 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LazyMessageLiteTest.java +319 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LazyStringArrayListTest.java +174 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LazyStringEndToEndTest.java +143 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java +85 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LiteTest.java +148 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LiteralByteStringTest.java +396 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/MessageTest.java +353 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/NestedBuildersTest.java +185 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/ParserTest.java +381 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/RepeatedFieldBuilderTest.java +190 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/RopeByteStringSubstringTest.java +97 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/RopeByteStringTest.java +115 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/ServiceTest.java +320 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/SingleFieldBuilderTest.java +155 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/SmallSortedMapTest.java +420 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/TestBadIdentifiers.java +96 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/TestUtil.java +4124 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/TextFormatTest.java +994 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/UnknownFieldSetTest.java +653 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/UnmodifiableLazyStringListTest.java +227 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/WireFormatTest.java +606 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/lazy_fields_lite.proto +61 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/lite_equals_and_hash.proto +55 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/multiple_files_test.proto +77 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/nested_builders_test.proto +53 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/nested_extension.proto +46 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/nested_extension_lite.proto +48 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/non_nested_extension.proto +49 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/non_nested_extension_lite.proto +50 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/outer_class_name_test.proto +38 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/outer_class_name_test2.proto +42 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/outer_class_name_test3.proto +43 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/test_bad_identifiers.proto +157 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/test_check_utf8.proto +50 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/test_check_utf8_size.proto +51 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/test_custom_options.proto +43 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/test_extra_interfaces.proto +60 -0
- data/ext/protoc/protobuf/m4/ac_system_extensions.m4 +37 -0
- data/ext/protoc/protobuf/m4/acx_check_suncc.m4 +75 -0
- data/ext/protoc/protobuf/m4/acx_pthread.m4 +397 -0
- data/ext/protoc/protobuf/m4/stl_hash.m4 +72 -0
- data/ext/protoc/protobuf/more_tests/Makefile +41 -0
- data/ext/protoc/protobuf/post_process_dist.sh +60 -0
- data/ext/protoc/protobuf/protobuf-lite.pc.in +13 -0
- data/ext/protoc/protobuf/protobuf.pc.in +14 -0
- data/ext/protoc/protobuf/python/README.txt +105 -0
- data/ext/protoc/protobuf/python/ez_setup.py +284 -0
- data/ext/protoc/protobuf/python/google/__init__.py +1 -0
- data/ext/protoc/protobuf/python/google/protobuf/__init__.py +0 -0
- data/ext/protoc/protobuf/python/google/protobuf/descriptor.py +849 -0
- data/ext/protoc/protobuf/python/google/protobuf/descriptor_database.py +137 -0
- data/ext/protoc/protobuf/python/google/protobuf/descriptor_pool.py +643 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/__init__.py +0 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/api_implementation.cc +139 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/api_implementation.py +89 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/api_implementation_default_test.py +63 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/containers.py +269 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/cpp_message.py +663 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/decoder.py +831 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/descriptor_database_test.py +63 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/descriptor_pool_test.py +564 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/descriptor_pool_test1.proto +94 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/descriptor_pool_test2.proto +70 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/descriptor_python_test.py +54 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/descriptor_test.py +669 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/encoder.py +788 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/enum_type_wrapper.py +89 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/factory_test1.proto +57 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/factory_test2.proto +92 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/generator_test.py +343 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/message_factory_python_test.py +54 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/message_factory_test.py +131 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/message_listener.py +78 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/message_python_test.py +54 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/message_test.py +681 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/missing_enum_values.proto +50 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/more_extensions.proto +58 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/more_extensions_dynamic.proto +49 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/more_messages.proto +51 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/python_message.py +1251 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/reflection_test.py +2934 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/service_reflection_test.py +136 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/symbol_database_test.py +120 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/test_bad_identifiers.proto +52 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/test_util.py +662 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/text_encoding_test.py +68 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/text_format_test.py +743 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/type_checkers.py +328 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/unknown_fields_test.py +231 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/wire_format.py +268 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/wire_format_test.py +253 -0
- data/ext/protoc/protobuf/python/google/protobuf/message.py +284 -0
- data/ext/protoc/protobuf/python/google/protobuf/message_factory.py +155 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/README +6 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/__init__.py +0 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/cpp_message.py +61 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/descriptor.cc +357 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/descriptor.h +96 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/descriptor_cpp2_test.py +58 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/extension_dict.cc +338 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/extension_dict.h +123 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/message.cc +2561 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/message.h +305 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/message_factory_cpp2_test.py +56 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/proto2_api_test.proto +38 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/python.proto +66 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/python_protobuf.h +57 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/reflection_cpp2_generated_test.py +94 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/repeated_composite_container.cc +763 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/repeated_composite_container.h +172 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/repeated_scalar_container.cc +825 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/repeated_scalar_container.h +112 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/scoped_pyobject_ptr.h +95 -0
- data/ext/protoc/protobuf/python/google/protobuf/reflection.py +205 -0
- data/ext/protoc/protobuf/python/google/protobuf/service.py +226 -0
- data/ext/protoc/protobuf/python/google/protobuf/service_reflection.py +284 -0
- data/ext/protoc/protobuf/python/google/protobuf/symbol_database.py +185 -0
- data/ext/protoc/protobuf/python/google/protobuf/text_encoding.py +110 -0
- data/ext/protoc/protobuf/python/google/protobuf/text_format.py +873 -0
- data/ext/protoc/protobuf/python/mox.py +1401 -0
- data/ext/protoc/protobuf/python/setup.py +201 -0
- data/ext/protoc/protobuf/python/stubout.py +140 -0
- data/ext/protoc/protobuf/src/Makefile.am +418 -0
- data/ext/protoc/protobuf/src/google/protobuf/SEBS +240 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/code_generator.cc +84 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/code_generator.h +145 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/command_line_interface.cc +1603 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/command_line_interface.h +378 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/command_line_interface_unittest.cc +1654 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc +158 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_enum.cc +288 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_enum.h +103 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_enum_field.cc +431 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_enum_field.h +122 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_extension.cc +210 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_extension.h +86 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_field.cc +166 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_field.h +185 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc +665 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_file.h +99 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_generator.cc +125 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_generator.h +72 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc +494 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.h +206 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_message.cc +2645 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_message.h +175 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_message_field.cc +375 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_message_field.h +121 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_options.h +58 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc +123 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc +451 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_primitive_field.h +123 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_service.cc +334 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_service.h +118 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_string_field.cc +642 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_string_field.h +127 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_test_bad_identifiers.proto +132 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_unittest.cc +2074 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_unittest.h +51 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/importer.cc +480 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/importer.h +317 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/importer_unittest.cc +617 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_context.cc +195 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_context.h +95 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_doc_comment.cc +233 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_doc_comment.h +69 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_doc_comment_unittest.cc +67 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_enum.cc +333 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_enum.h +99 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_enum_field.cc +778 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_enum_field.h +158 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_extension.cc +207 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_extension.h +109 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_field.cc +213 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_field.h +162 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_file.cc +534 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_file.h +115 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_generator.cc +158 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_generator.h +72 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_generator_factory.cc +77 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_generator_factory.h +101 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_helpers.cc +737 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_helpers.h +322 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_lazy_message_field.cc +826 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_lazy_message_field.h +121 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_message.cc +1666 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_message.h +140 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_message_field.cc +1343 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_message_field.h +173 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_name_resolver.cc +266 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_name_resolver.h +124 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_plugin_unittest.cc +124 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_primitive_field.cc +877 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_primitive_field.h +160 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_service.cc +473 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_service.h +135 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_shared_code_generator.cc +201 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_shared_code_generator.h +90 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_string_field.cc +1056 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_string_field.h +160 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/main.cc +61 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/mock_code_generator.cc +240 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/mock_code_generator.h +117 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/package_info.h +64 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/parser.cc +1750 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/parser.h +522 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/parser_unittest.cc +2612 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/plugin.cc +163 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/plugin.h +72 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/plugin.pb.cc +1148 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/plugin.pb.h +897 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/plugin.proto +147 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/python/python_generator.cc +1262 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/python/python_generator.h +166 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/python/python_plugin_unittest.cc +118 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/subprocess.cc +463 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/subprocess.h +108 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/test_plugin.cc +51 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/zip_output_unittest.sh +91 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/zip_writer.cc +218 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/zip_writer.h +93 -0
- data/ext/protoc/protobuf/src/google/protobuf/descriptor.cc +5420 -0
- data/ext/protoc/protobuf/src/google/protobuf/descriptor.h +1691 -0
- data/ext/protoc/protobuf/src/google/protobuf/descriptor.pb.cc +9135 -0
- data/ext/protoc/protobuf/src/google/protobuf/descriptor.pb.h +6761 -0
- data/ext/protoc/protobuf/src/google/protobuf/descriptor.proto +687 -0
- data/ext/protoc/protobuf/src/google/protobuf/descriptor_database.cc +543 -0
- data/ext/protoc/protobuf/src/google/protobuf/descriptor_database.h +369 -0
- data/ext/protoc/protobuf/src/google/protobuf/descriptor_database_unittest.cc +748 -0
- data/ext/protoc/protobuf/src/google/protobuf/descriptor_pb2_test.py +54 -0
- data/ext/protoc/protobuf/src/google/protobuf/descriptor_unittest.cc +5501 -0
- data/ext/protoc/protobuf/src/google/protobuf/dynamic_message.cc +764 -0
- data/ext/protoc/protobuf/src/google/protobuf/dynamic_message.h +148 -0
- data/ext/protoc/protobuf/src/google/protobuf/dynamic_message_unittest.cc +230 -0
- data/ext/protoc/protobuf/src/google/protobuf/extension_set.cc +1663 -0
- data/ext/protoc/protobuf/src/google/protobuf/extension_set.h +1234 -0
- data/ext/protoc/protobuf/src/google/protobuf/extension_set_heavy.cc +734 -0
- data/ext/protoc/protobuf/src/google/protobuf/extension_set_unittest.cc +1095 -0
- data/ext/protoc/protobuf/src/google/protobuf/generated_enum_reflection.h +91 -0
- data/ext/protoc/protobuf/src/google/protobuf/generated_message_reflection.cc +1683 -0
- data/ext/protoc/protobuf/src/google/protobuf/generated_message_reflection.h +504 -0
- data/ext/protoc/protobuf/src/google/protobuf/generated_message_reflection_unittest.cc +795 -0
- data/ext/protoc/protobuf/src/google/protobuf/generated_message_util.cc +65 -0
- data/ext/protoc/protobuf/src/google/protobuf/generated_message_util.h +113 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/coded_stream.cc +914 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/coded_stream.h +1220 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/coded_stream_inl.h +69 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/coded_stream_unittest.cc +1378 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/gzip_stream.cc +326 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/gzip_stream.h +209 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/gzip_stream_unittest.sh +44 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/package_info.h +54 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/printer.cc +198 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/printer.h +136 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/printer_unittest.cc +285 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/strtod.cc +113 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/strtod.h +50 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/tokenizer.cc +1127 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/tokenizer.h +402 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/tokenizer_unittest.cc +999 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream.cc +57 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream.h +248 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream_impl.cc +473 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream_impl.h +358 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc +405 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h +354 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream_unittest.cc +965 -0
- data/ext/protoc/protobuf/src/google/protobuf/lite_unittest.cc +350 -0
- data/ext/protoc/protobuf/src/google/protobuf/message.cc +358 -0
- data/ext/protoc/protobuf/src/google/protobuf/message.h +866 -0
- data/ext/protoc/protobuf/src/google/protobuf/message_lite.cc +335 -0
- data/ext/protoc/protobuf/src/google/protobuf/message_lite.h +247 -0
- data/ext/protoc/protobuf/src/google/protobuf/message_unittest.cc +427 -0
- data/ext/protoc/protobuf/src/google/protobuf/package_info.h +64 -0
- data/ext/protoc/protobuf/src/google/protobuf/reflection_ops.cc +269 -0
- data/ext/protoc/protobuf/src/google/protobuf/reflection_ops.h +81 -0
- data/ext/protoc/protobuf/src/google/protobuf/reflection_ops_unittest.cc +475 -0
- data/ext/protoc/protobuf/src/google/protobuf/repeated_field.cc +87 -0
- data/ext/protoc/protobuf/src/google/protobuf/repeated_field.h +1603 -0
- data/ext/protoc/protobuf/src/google/protobuf/repeated_field_reflection_unittest.cc +195 -0
- data/ext/protoc/protobuf/src/google/protobuf/repeated_field_unittest.cc +1442 -0
- data/ext/protoc/protobuf/src/google/protobuf/service.cc +46 -0
- data/ext/protoc/protobuf/src/google/protobuf/service.h +291 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops.h +227 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_arm64_gcc.h +325 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_arm_gcc.h +151 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_arm_qnx.h +146 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_atomicword_compat.h +122 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h +137 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_macosx.h +225 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_mips_gcc.h +313 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_pnacl.h +73 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_solaris.h +188 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_tsan.h +219 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc +137 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_x86_gcc.h +293 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc +112 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_x86_msvc.h +150 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/common.cc +395 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/common.h +1226 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/common_unittest.cc +357 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/hash.h +232 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/map_util.h +771 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/once.cc +99 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/once.h +166 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/once_unittest.cc +253 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/platform_macros.h +103 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/shared_ptr.h +470 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/stl_util.h +121 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/stringprintf.cc +175 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/stringprintf.h +76 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/stringprintf_unittest.cc +152 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/structurally_valid.cc +536 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/structurally_valid_unittest.cc +40 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/strutil.cc +1279 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/strutil.h +562 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/strutil_unittest.cc +73 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/substitute.cc +134 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/substitute.h +170 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/template_util.h +138 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/template_util_unittest.cc +130 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/type_traits.h +336 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/type_traits_unittest.cc +628 -0
- data/ext/protoc/protobuf/src/google/protobuf/test_util.cc +3345 -0
- data/ext/protoc/protobuf/src/google/protobuf/test_util.h +215 -0
- data/ext/protoc/protobuf/src/google/protobuf/test_util_lite.cc +1585 -0
- data/ext/protoc/protobuf/src/google/protobuf/test_util_lite.h +101 -0
- data/ext/protoc/protobuf/src/google/protobuf/testdata/bad_utf8_string +1 -0
- data/ext/protoc/protobuf/src/google/protobuf/testdata/golden_message +0 -0
- data/ext/protoc/protobuf/src/google/protobuf/testdata/golden_message_oneof_implemented +0 -0
- data/ext/protoc/protobuf/src/google/protobuf/testdata/golden_packed_fields_message +0 -0
- data/ext/protoc/protobuf/src/google/protobuf/testdata/text_format_unittest_data.txt +134 -0
- data/ext/protoc/protobuf/src/google/protobuf/testdata/text_format_unittest_data_oneof_implemented.txt +129 -0
- data/ext/protoc/protobuf/src/google/protobuf/testdata/text_format_unittest_data_pointy.txt +134 -0
- data/ext/protoc/protobuf/src/google/protobuf/testdata/text_format_unittest_data_pointy_oneof.txt +129 -0
- data/ext/protoc/protobuf/src/google/protobuf/testdata/text_format_unittest_extensions_data.txt +134 -0
- data/ext/protoc/protobuf/src/google/protobuf/testdata/text_format_unittest_extensions_data_pointy.txt +134 -0
- data/ext/protoc/protobuf/src/google/protobuf/testing/file.cc +194 -0
- data/ext/protoc/protobuf/src/google/protobuf/testing/file.h +97 -0
- data/ext/protoc/protobuf/src/google/protobuf/testing/googletest.cc +255 -0
- data/ext/protoc/protobuf/src/google/protobuf/testing/googletest.h +102 -0
- data/ext/protoc/protobuf/src/google/protobuf/testing/zcgunzip.cc +73 -0
- data/ext/protoc/protobuf/src/google/protobuf/testing/zcgzip.cc +79 -0
- data/ext/protoc/protobuf/src/google/protobuf/text_format.cc +1746 -0
- data/ext/protoc/protobuf/src/google/protobuf/text_format.h +473 -0
- data/ext/protoc/protobuf/src/google/protobuf/text_format_unittest.cc +1479 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest.proto +861 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_custom_options.proto +393 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_embed_optimize_for.proto +50 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_empty.proto +37 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_enormous_descriptor.proto +1046 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_import.proto +64 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_import_lite.proto +51 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_import_public.proto +40 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_import_public_lite.proto +42 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_lite.proto +384 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_lite_imports_nonlite.proto +43 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_mset.proto +83 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_no_generic_services.proto +53 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_optimize_for.proto +66 -0
- data/ext/protoc/protobuf/src/google/protobuf/unknown_field_set.cc +265 -0
- data/ext/protoc/protobuf/src/google/protobuf/unknown_field_set.h +318 -0
- data/ext/protoc/protobuf/src/google/protobuf/unknown_field_set_unittest.cc +599 -0
- data/ext/protoc/protobuf/src/google/protobuf/wire_format.cc +1101 -0
- data/ext/protoc/protobuf/src/google/protobuf/wire_format.h +336 -0
- data/ext/protoc/protobuf/src/google/protobuf/wire_format_lite.cc +471 -0
- data/ext/protoc/protobuf/src/google/protobuf/wire_format_lite.h +661 -0
- data/ext/protoc/protobuf/src/google/protobuf/wire_format_lite_inl.h +860 -0
- data/ext/protoc/protobuf/src/google/protobuf/wire_format_unittest.cc +1120 -0
- data/ext/protoc/protobuf/src/solaris/libstdc++.la +51 -0
- data/ext/protoc/protobuf/vsprojects/config.h +29 -0
- data/ext/protoc/protobuf/vsprojects/convert2008to2005.sh +20 -0
- data/ext/protoc/protobuf/vsprojects/extract_includes.bat +50 -0
- data/ext/protoc/protobuf/vsprojects/libprotobuf-lite.vcproj +302 -0
- data/ext/protoc/protobuf/vsprojects/libprotobuf.vcproj +470 -0
- data/ext/protoc/protobuf/vsprojects/libprotoc.vcproj +466 -0
- data/ext/protoc/protobuf/vsprojects/lite-test.vcproj +305 -0
- data/ext/protoc/protobuf/vsprojects/protobuf.sln +92 -0
- data/ext/protoc/protobuf/vsprojects/protoc.vcproj +192 -0
- data/ext/protoc/protobuf/vsprojects/readme.txt +114 -0
- data/ext/protoc/protobuf/vsprojects/test_plugin.vcproj +209 -0
- data/ext/protoc/protobuf/vsprojects/tests.vcproj +681 -0
- data/lib/protoc/version.rb +1 -1
- metadata +480 -3
data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/UninitializedMessageException.java
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
// Protocol Buffers - Google's data interchange format
|
2
|
+
// Copyright 2008 Google Inc. All rights reserved.
|
3
|
+
// https://developers.google.com/protocol-buffers/
|
4
|
+
//
|
5
|
+
// Redistribution and use in source and binary forms, with or without
|
6
|
+
// modification, are permitted provided that the following conditions are
|
7
|
+
// met:
|
8
|
+
//
|
9
|
+
// * Redistributions of source code must retain the above copyright
|
10
|
+
// notice, this list of conditions and the following disclaimer.
|
11
|
+
// * Redistributions in binary form must reproduce the above
|
12
|
+
// copyright notice, this list of conditions and the following disclaimer
|
13
|
+
// in the documentation and/or other materials provided with the
|
14
|
+
// distribution.
|
15
|
+
// * Neither the name of Google Inc. nor the names of its
|
16
|
+
// contributors may be used to endorse or promote products derived from
|
17
|
+
// this software without specific prior written permission.
|
18
|
+
//
|
19
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
20
|
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
21
|
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
22
|
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
23
|
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
24
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
25
|
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
26
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
27
|
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
28
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
29
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30
|
+
|
31
|
+
package com.google.protobuf;
|
32
|
+
|
33
|
+
import java.util.Collections;
|
34
|
+
import java.util.List;
|
35
|
+
|
36
|
+
/**
|
37
|
+
* Thrown when attempting to build a protocol message that is missing required
|
38
|
+
* fields. This is a {@code RuntimeException} because it normally represents
|
39
|
+
* a programming error: it happens when some code which constructs a message
|
40
|
+
* fails to set all the fields. {@code parseFrom()} methods <b>do not</b>
|
41
|
+
* throw this; they throw an {@link InvalidProtocolBufferException} if
|
42
|
+
* required fields are missing, because it is not a programming error to
|
43
|
+
* receive an incomplete message. In other words,
|
44
|
+
* {@code UninitializedMessageException} should never be thrown by correct
|
45
|
+
* code, but {@code InvalidProtocolBufferException} might be.
|
46
|
+
*
|
47
|
+
* @author kenton@google.com Kenton Varda
|
48
|
+
*/
|
49
|
+
public class UninitializedMessageException extends RuntimeException {
|
50
|
+
private static final long serialVersionUID = -7466929953374883507L;
|
51
|
+
|
52
|
+
public UninitializedMessageException(final MessageLite message) {
|
53
|
+
super("Message was missing required fields. (Lite runtime could not " +
|
54
|
+
"determine which fields were missing).");
|
55
|
+
missingFields = null;
|
56
|
+
}
|
57
|
+
|
58
|
+
public UninitializedMessageException(final List<String> missingFields) {
|
59
|
+
super(buildDescription(missingFields));
|
60
|
+
this.missingFields = missingFields;
|
61
|
+
}
|
62
|
+
|
63
|
+
private final List<String> missingFields;
|
64
|
+
|
65
|
+
/**
|
66
|
+
* Get a list of human-readable names of required fields missing from this
|
67
|
+
* message. Each name is a full path to a field, e.g. "foo.bar[5].baz".
|
68
|
+
* Returns null if the lite runtime was used, since it lacks the ability to
|
69
|
+
* find missing fields.
|
70
|
+
*/
|
71
|
+
public List<String> getMissingFields() {
|
72
|
+
return Collections.unmodifiableList(missingFields);
|
73
|
+
}
|
74
|
+
|
75
|
+
/**
|
76
|
+
* Converts this exception to an {@link InvalidProtocolBufferException}.
|
77
|
+
* When a parsed message is missing required fields, this should be thrown
|
78
|
+
* instead of {@code UninitializedMessageException}.
|
79
|
+
*/
|
80
|
+
public InvalidProtocolBufferException asInvalidProtocolBufferException() {
|
81
|
+
return new InvalidProtocolBufferException(getMessage());
|
82
|
+
}
|
83
|
+
|
84
|
+
/** Construct the description string for this exception. */
|
85
|
+
private static String buildDescription(final List<String> missingFields) {
|
86
|
+
final StringBuilder description =
|
87
|
+
new StringBuilder("Message missing required fields: ");
|
88
|
+
boolean first = true;
|
89
|
+
for (final String field : missingFields) {
|
90
|
+
if (first) {
|
91
|
+
first = false;
|
92
|
+
} else {
|
93
|
+
description.append(", ");
|
94
|
+
}
|
95
|
+
description.append(field);
|
96
|
+
}
|
97
|
+
return description.toString();
|
98
|
+
}
|
99
|
+
}
|
@@ -0,0 +1,995 @@
|
|
1
|
+
// Protocol Buffers - Google's data interchange format
|
2
|
+
// Copyright 2008 Google Inc. All rights reserved.
|
3
|
+
// https://developers.google.com/protocol-buffers/
|
4
|
+
//
|
5
|
+
// Redistribution and use in source and binary forms, with or without
|
6
|
+
// modification, are permitted provided that the following conditions are
|
7
|
+
// met:
|
8
|
+
//
|
9
|
+
// * Redistributions of source code must retain the above copyright
|
10
|
+
// notice, this list of conditions and the following disclaimer.
|
11
|
+
// * Redistributions in binary form must reproduce the above
|
12
|
+
// copyright notice, this list of conditions and the following disclaimer
|
13
|
+
// in the documentation and/or other materials provided with the
|
14
|
+
// distribution.
|
15
|
+
// * Neither the name of Google Inc. nor the names of its
|
16
|
+
// contributors may be used to endorse or promote products derived from
|
17
|
+
// this software without specific prior written permission.
|
18
|
+
//
|
19
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
20
|
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
21
|
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
22
|
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
23
|
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
24
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
25
|
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
26
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
27
|
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
28
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
29
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30
|
+
|
31
|
+
package com.google.protobuf;
|
32
|
+
|
33
|
+
import com.google.protobuf.AbstractMessageLite.Builder.LimitedInputStream;
|
34
|
+
|
35
|
+
import java.io.IOException;
|
36
|
+
import java.io.InputStream;
|
37
|
+
import java.io.OutputStream;
|
38
|
+
import java.util.ArrayList;
|
39
|
+
import java.util.Arrays;
|
40
|
+
import java.util.Collections;
|
41
|
+
import java.util.List;
|
42
|
+
import java.util.Map;
|
43
|
+
import java.util.TreeMap;
|
44
|
+
|
45
|
+
/**
|
46
|
+
* {@code UnknownFieldSet} is used to keep track of fields which were seen when
|
47
|
+
* parsing a protocol message but whose field numbers or types are unrecognized.
|
48
|
+
* This most frequently occurs when new fields are added to a message type
|
49
|
+
* and then messages containing those fields are read by old software that was
|
50
|
+
* compiled before the new types were added.
|
51
|
+
*
|
52
|
+
* <p>Every {@link Message} contains an {@code UnknownFieldSet} (and every
|
53
|
+
* {@link Message.Builder} contains an {@link Builder}).
|
54
|
+
*
|
55
|
+
* <p>Most users will never need to use this class.
|
56
|
+
*
|
57
|
+
* @author kenton@google.com Kenton Varda
|
58
|
+
*/
|
59
|
+
public final class UnknownFieldSet implements MessageLite {
|
60
|
+
private UnknownFieldSet() {}
|
61
|
+
|
62
|
+
/** Create a new {@link Builder}. */
|
63
|
+
public static Builder newBuilder() {
|
64
|
+
return Builder.create();
|
65
|
+
}
|
66
|
+
|
67
|
+
/**
|
68
|
+
* Create a new {@link Builder} and initialize it to be a copy
|
69
|
+
* of {@code copyFrom}.
|
70
|
+
*/
|
71
|
+
public static Builder newBuilder(final UnknownFieldSet copyFrom) {
|
72
|
+
return newBuilder().mergeFrom(copyFrom);
|
73
|
+
}
|
74
|
+
|
75
|
+
/** Get an empty {@code UnknownFieldSet}. */
|
76
|
+
public static UnknownFieldSet getDefaultInstance() {
|
77
|
+
return defaultInstance;
|
78
|
+
}
|
79
|
+
public UnknownFieldSet getDefaultInstanceForType() {
|
80
|
+
return defaultInstance;
|
81
|
+
}
|
82
|
+
private static final UnknownFieldSet defaultInstance =
|
83
|
+
new UnknownFieldSet(Collections.<Integer, Field>emptyMap());
|
84
|
+
|
85
|
+
/**
|
86
|
+
* Construct an {@code UnknownFieldSet} around the given map. The map is
|
87
|
+
* expected to be immutable.
|
88
|
+
*/
|
89
|
+
private UnknownFieldSet(final Map<Integer, Field> fields) {
|
90
|
+
this.fields = fields;
|
91
|
+
}
|
92
|
+
private Map<Integer, Field> fields;
|
93
|
+
|
94
|
+
|
95
|
+
@Override
|
96
|
+
public boolean equals(final Object other) {
|
97
|
+
if (this == other) {
|
98
|
+
return true;
|
99
|
+
}
|
100
|
+
return (other instanceof UnknownFieldSet) &&
|
101
|
+
fields.equals(((UnknownFieldSet) other).fields);
|
102
|
+
}
|
103
|
+
|
104
|
+
@Override
|
105
|
+
public int hashCode() {
|
106
|
+
return fields.hashCode();
|
107
|
+
}
|
108
|
+
|
109
|
+
/** Get a map of fields in the set by number. */
|
110
|
+
public Map<Integer, Field> asMap() {
|
111
|
+
return fields;
|
112
|
+
}
|
113
|
+
|
114
|
+
/** Check if the given field number is present in the set. */
|
115
|
+
public boolean hasField(final int number) {
|
116
|
+
return fields.containsKey(number);
|
117
|
+
}
|
118
|
+
|
119
|
+
/**
|
120
|
+
* Get a field by number. Returns an empty field if not present. Never
|
121
|
+
* returns {@code null}.
|
122
|
+
*/
|
123
|
+
public Field getField(final int number) {
|
124
|
+
final Field result = fields.get(number);
|
125
|
+
return (result == null) ? Field.getDefaultInstance() : result;
|
126
|
+
}
|
127
|
+
|
128
|
+
/** Serializes the set and writes it to {@code output}. */
|
129
|
+
public void writeTo(final CodedOutputStream output) throws IOException {
|
130
|
+
for (final Map.Entry<Integer, Field> entry : fields.entrySet()) {
|
131
|
+
entry.getValue().writeTo(entry.getKey(), output);
|
132
|
+
}
|
133
|
+
}
|
134
|
+
|
135
|
+
/**
|
136
|
+
* Converts the set to a string in protocol buffer text format. This is
|
137
|
+
* just a trivial wrapper around
|
138
|
+
* {@link TextFormat#printToString(UnknownFieldSet)}.
|
139
|
+
*/
|
140
|
+
@Override
|
141
|
+
public String toString() {
|
142
|
+
return TextFormat.printToString(this);
|
143
|
+
}
|
144
|
+
|
145
|
+
/**
|
146
|
+
* Serializes the message to a {@code ByteString} and returns it. This is
|
147
|
+
* just a trivial wrapper around {@link #writeTo(CodedOutputStream)}.
|
148
|
+
*/
|
149
|
+
public ByteString toByteString() {
|
150
|
+
try {
|
151
|
+
final ByteString.CodedBuilder out =
|
152
|
+
ByteString.newCodedBuilder(getSerializedSize());
|
153
|
+
writeTo(out.getCodedOutput());
|
154
|
+
return out.build();
|
155
|
+
} catch (final IOException e) {
|
156
|
+
throw new RuntimeException(
|
157
|
+
"Serializing to a ByteString threw an IOException (should " +
|
158
|
+
"never happen).", e);
|
159
|
+
}
|
160
|
+
}
|
161
|
+
|
162
|
+
/**
|
163
|
+
* Serializes the message to a {@code byte} array and returns it. This is
|
164
|
+
* just a trivial wrapper around {@link #writeTo(CodedOutputStream)}.
|
165
|
+
*/
|
166
|
+
public byte[] toByteArray() {
|
167
|
+
try {
|
168
|
+
final byte[] result = new byte[getSerializedSize()];
|
169
|
+
final CodedOutputStream output = CodedOutputStream.newInstance(result);
|
170
|
+
writeTo(output);
|
171
|
+
output.checkNoSpaceLeft();
|
172
|
+
return result;
|
173
|
+
} catch (final IOException e) {
|
174
|
+
throw new RuntimeException(
|
175
|
+
"Serializing to a byte array threw an IOException " +
|
176
|
+
"(should never happen).", e);
|
177
|
+
}
|
178
|
+
}
|
179
|
+
|
180
|
+
/**
|
181
|
+
* Serializes the message and writes it to {@code output}. This is just a
|
182
|
+
* trivial wrapper around {@link #writeTo(CodedOutputStream)}.
|
183
|
+
*/
|
184
|
+
public void writeTo(final OutputStream output) throws IOException {
|
185
|
+
final CodedOutputStream codedOutput = CodedOutputStream.newInstance(output);
|
186
|
+
writeTo(codedOutput);
|
187
|
+
codedOutput.flush();
|
188
|
+
}
|
189
|
+
|
190
|
+
public void writeDelimitedTo(OutputStream output) throws IOException {
|
191
|
+
final CodedOutputStream codedOutput = CodedOutputStream.newInstance(output);
|
192
|
+
codedOutput.writeRawVarint32(getSerializedSize());
|
193
|
+
writeTo(codedOutput);
|
194
|
+
codedOutput.flush();
|
195
|
+
}
|
196
|
+
|
197
|
+
/** Get the number of bytes required to encode this set. */
|
198
|
+
public int getSerializedSize() {
|
199
|
+
int result = 0;
|
200
|
+
for (final Map.Entry<Integer, Field> entry : fields.entrySet()) {
|
201
|
+
result += entry.getValue().getSerializedSize(entry.getKey());
|
202
|
+
}
|
203
|
+
return result;
|
204
|
+
}
|
205
|
+
|
206
|
+
/**
|
207
|
+
* Serializes the set and writes it to {@code output} using
|
208
|
+
* {@code MessageSet} wire format.
|
209
|
+
*/
|
210
|
+
public void writeAsMessageSetTo(final CodedOutputStream output)
|
211
|
+
throws IOException {
|
212
|
+
for (final Map.Entry<Integer, Field> entry : fields.entrySet()) {
|
213
|
+
entry.getValue().writeAsMessageSetExtensionTo(
|
214
|
+
entry.getKey(), output);
|
215
|
+
}
|
216
|
+
}
|
217
|
+
|
218
|
+
/**
|
219
|
+
* Get the number of bytes required to encode this set using
|
220
|
+
* {@code MessageSet} wire format.
|
221
|
+
*/
|
222
|
+
public int getSerializedSizeAsMessageSet() {
|
223
|
+
int result = 0;
|
224
|
+
for (final Map.Entry<Integer, Field> entry : fields.entrySet()) {
|
225
|
+
result += entry.getValue().getSerializedSizeAsMessageSetExtension(
|
226
|
+
entry.getKey());
|
227
|
+
}
|
228
|
+
return result;
|
229
|
+
}
|
230
|
+
|
231
|
+
public boolean isInitialized() {
|
232
|
+
// UnknownFieldSets do not have required fields, so they are always
|
233
|
+
// initialized.
|
234
|
+
return true;
|
235
|
+
}
|
236
|
+
|
237
|
+
/** Parse an {@code UnknownFieldSet} from the given input stream. */
|
238
|
+
public static UnknownFieldSet parseFrom(final CodedInputStream input)
|
239
|
+
throws IOException {
|
240
|
+
return newBuilder().mergeFrom(input).build();
|
241
|
+
}
|
242
|
+
|
243
|
+
/** Parse {@code data} as an {@code UnknownFieldSet} and return it. */
|
244
|
+
public static UnknownFieldSet parseFrom(final ByteString data)
|
245
|
+
throws InvalidProtocolBufferException {
|
246
|
+
return newBuilder().mergeFrom(data).build();
|
247
|
+
}
|
248
|
+
|
249
|
+
/** Parse {@code data} as an {@code UnknownFieldSet} and return it. */
|
250
|
+
public static UnknownFieldSet parseFrom(final byte[] data)
|
251
|
+
throws InvalidProtocolBufferException {
|
252
|
+
return newBuilder().mergeFrom(data).build();
|
253
|
+
}
|
254
|
+
|
255
|
+
/** Parse an {@code UnknownFieldSet} from {@code input} and return it. */
|
256
|
+
public static UnknownFieldSet parseFrom(final InputStream input)
|
257
|
+
throws IOException {
|
258
|
+
return newBuilder().mergeFrom(input).build();
|
259
|
+
}
|
260
|
+
|
261
|
+
public Builder newBuilderForType() {
|
262
|
+
return newBuilder();
|
263
|
+
}
|
264
|
+
|
265
|
+
public Builder toBuilder() {
|
266
|
+
return newBuilder().mergeFrom(this);
|
267
|
+
}
|
268
|
+
|
269
|
+
/**
|
270
|
+
* Builder for {@link UnknownFieldSet}s.
|
271
|
+
*
|
272
|
+
* <p>Note that this class maintains {@link Field.Builder}s for all fields
|
273
|
+
* in the set. Thus, adding one element to an existing {@link Field} does not
|
274
|
+
* require making a copy. This is important for efficient parsing of
|
275
|
+
* unknown repeated fields. However, it implies that {@link Field}s cannot
|
276
|
+
* be constructed independently, nor can two {@link UnknownFieldSet}s share
|
277
|
+
* the same {@code Field} object.
|
278
|
+
*
|
279
|
+
* <p>Use {@link UnknownFieldSet#newBuilder()} to construct a {@code Builder}.
|
280
|
+
*/
|
281
|
+
public static final class Builder implements MessageLite.Builder {
|
282
|
+
// This constructor should never be called directly (except from 'create').
|
283
|
+
private Builder() {}
|
284
|
+
|
285
|
+
private Map<Integer, Field> fields;
|
286
|
+
|
287
|
+
// Optimization: We keep around a builder for the last field that was
|
288
|
+
// modified so that we can efficiently add to it multiple times in a
|
289
|
+
// row (important when parsing an unknown repeated field).
|
290
|
+
private int lastFieldNumber;
|
291
|
+
private Field.Builder lastField;
|
292
|
+
|
293
|
+
private static Builder create() {
|
294
|
+
Builder builder = new Builder();
|
295
|
+
builder.reinitialize();
|
296
|
+
return builder;
|
297
|
+
}
|
298
|
+
|
299
|
+
/**
|
300
|
+
* Get a field builder for the given field number which includes any
|
301
|
+
* values that already exist.
|
302
|
+
*/
|
303
|
+
private Field.Builder getFieldBuilder(final int number) {
|
304
|
+
if (lastField != null) {
|
305
|
+
if (number == lastFieldNumber) {
|
306
|
+
return lastField;
|
307
|
+
}
|
308
|
+
// Note: addField() will reset lastField and lastFieldNumber.
|
309
|
+
addField(lastFieldNumber, lastField.build());
|
310
|
+
}
|
311
|
+
if (number == 0) {
|
312
|
+
return null;
|
313
|
+
} else {
|
314
|
+
final Field existing = fields.get(number);
|
315
|
+
lastFieldNumber = number;
|
316
|
+
lastField = Field.newBuilder();
|
317
|
+
if (existing != null) {
|
318
|
+
lastField.mergeFrom(existing);
|
319
|
+
}
|
320
|
+
return lastField;
|
321
|
+
}
|
322
|
+
}
|
323
|
+
|
324
|
+
/**
|
325
|
+
* Build the {@link UnknownFieldSet} and return it.
|
326
|
+
*
|
327
|
+
* <p>Once {@code build()} has been called, the {@code Builder} will no
|
328
|
+
* longer be usable. Calling any method after {@code build()} will result
|
329
|
+
* in undefined behavior and can cause a {@code NullPointerException} to be
|
330
|
+
* thrown.
|
331
|
+
*/
|
332
|
+
public UnknownFieldSet build() {
|
333
|
+
getFieldBuilder(0); // Force lastField to be built.
|
334
|
+
final UnknownFieldSet result;
|
335
|
+
if (fields.isEmpty()) {
|
336
|
+
result = getDefaultInstance();
|
337
|
+
} else {
|
338
|
+
result = new UnknownFieldSet(Collections.unmodifiableMap(fields));
|
339
|
+
}
|
340
|
+
fields = null;
|
341
|
+
return result;
|
342
|
+
}
|
343
|
+
|
344
|
+
public UnknownFieldSet buildPartial() {
|
345
|
+
// No required fields, so this is the same as build().
|
346
|
+
return build();
|
347
|
+
}
|
348
|
+
|
349
|
+
@Override
|
350
|
+
public Builder clone() {
|
351
|
+
getFieldBuilder(0); // Force lastField to be built.
|
352
|
+
return UnknownFieldSet.newBuilder().mergeFrom(
|
353
|
+
new UnknownFieldSet(fields));
|
354
|
+
}
|
355
|
+
|
356
|
+
public UnknownFieldSet getDefaultInstanceForType() {
|
357
|
+
return UnknownFieldSet.getDefaultInstance();
|
358
|
+
}
|
359
|
+
|
360
|
+
private void reinitialize() {
|
361
|
+
fields = Collections.emptyMap();
|
362
|
+
lastFieldNumber = 0;
|
363
|
+
lastField = null;
|
364
|
+
}
|
365
|
+
|
366
|
+
/** Reset the builder to an empty set. */
|
367
|
+
public Builder clear() {
|
368
|
+
reinitialize();
|
369
|
+
return this;
|
370
|
+
}
|
371
|
+
|
372
|
+
/** Clear fields from the set with a given field number. */
|
373
|
+
public Builder clearField(final int number) {
|
374
|
+
if (number == 0) {
|
375
|
+
throw new IllegalArgumentException("Zero is not a valid field number.");
|
376
|
+
}
|
377
|
+
if (lastField != null && lastFieldNumber == number) {
|
378
|
+
// Discard this.
|
379
|
+
lastField = null;
|
380
|
+
lastFieldNumber = 0;
|
381
|
+
}
|
382
|
+
if (fields.containsKey(number)) {
|
383
|
+
fields.remove(number);
|
384
|
+
}
|
385
|
+
return this;
|
386
|
+
}
|
387
|
+
|
388
|
+
/**
|
389
|
+
* Merge the fields from {@code other} into this set. If a field number
|
390
|
+
* exists in both sets, {@code other}'s values for that field will be
|
391
|
+
* appended to the values in this set.
|
392
|
+
*/
|
393
|
+
public Builder mergeFrom(final UnknownFieldSet other) {
|
394
|
+
if (other != getDefaultInstance()) {
|
395
|
+
for (final Map.Entry<Integer, Field> entry : other.fields.entrySet()) {
|
396
|
+
mergeField(entry.getKey(), entry.getValue());
|
397
|
+
}
|
398
|
+
}
|
399
|
+
return this;
|
400
|
+
}
|
401
|
+
|
402
|
+
/**
|
403
|
+
* Add a field to the {@code UnknownFieldSet}. If a field with the same
|
404
|
+
* number already exists, the two are merged.
|
405
|
+
*/
|
406
|
+
public Builder mergeField(final int number, final Field field) {
|
407
|
+
if (number == 0) {
|
408
|
+
throw new IllegalArgumentException("Zero is not a valid field number.");
|
409
|
+
}
|
410
|
+
if (hasField(number)) {
|
411
|
+
getFieldBuilder(number).mergeFrom(field);
|
412
|
+
} else {
|
413
|
+
// Optimization: We could call getFieldBuilder(number).mergeFrom(field)
|
414
|
+
// in this case, but that would create a copy of the Field object.
|
415
|
+
// We'd rather reuse the one passed to us, so call addField() instead.
|
416
|
+
addField(number, field);
|
417
|
+
}
|
418
|
+
return this;
|
419
|
+
}
|
420
|
+
|
421
|
+
/**
|
422
|
+
* Convenience method for merging a new field containing a single varint
|
423
|
+
* value. This is used in particular when an unknown enum value is
|
424
|
+
* encountered.
|
425
|
+
*/
|
426
|
+
public Builder mergeVarintField(final int number, final int value) {
|
427
|
+
if (number == 0) {
|
428
|
+
throw new IllegalArgumentException("Zero is not a valid field number.");
|
429
|
+
}
|
430
|
+
getFieldBuilder(number).addVarint(value);
|
431
|
+
return this;
|
432
|
+
}
|
433
|
+
|
434
|
+
/** Check if the given field number is present in the set. */
|
435
|
+
public boolean hasField(final int number) {
|
436
|
+
if (number == 0) {
|
437
|
+
throw new IllegalArgumentException("Zero is not a valid field number.");
|
438
|
+
}
|
439
|
+
return number == lastFieldNumber || fields.containsKey(number);
|
440
|
+
}
|
441
|
+
|
442
|
+
/**
|
443
|
+
* Add a field to the {@code UnknownFieldSet}. If a field with the same
|
444
|
+
* number already exists, it is removed.
|
445
|
+
*/
|
446
|
+
public Builder addField(final int number, final Field field) {
|
447
|
+
if (number == 0) {
|
448
|
+
throw new IllegalArgumentException("Zero is not a valid field number.");
|
449
|
+
}
|
450
|
+
if (lastField != null && lastFieldNumber == number) {
|
451
|
+
// Discard this.
|
452
|
+
lastField = null;
|
453
|
+
lastFieldNumber = 0;
|
454
|
+
}
|
455
|
+
if (fields.isEmpty()) {
|
456
|
+
fields = new TreeMap<Integer,Field>();
|
457
|
+
}
|
458
|
+
fields.put(number, field);
|
459
|
+
return this;
|
460
|
+
}
|
461
|
+
|
462
|
+
/**
|
463
|
+
* Get all present {@code Field}s as an immutable {@code Map}. If more
|
464
|
+
* fields are added, the changes may or may not be reflected in this map.
|
465
|
+
*/
|
466
|
+
public Map<Integer, Field> asMap() {
|
467
|
+
getFieldBuilder(0); // Force lastField to be built.
|
468
|
+
return Collections.unmodifiableMap(fields);
|
469
|
+
}
|
470
|
+
|
471
|
+
/**
|
472
|
+
* Parse an entire message from {@code input} and merge its fields into
|
473
|
+
* this set.
|
474
|
+
*/
|
475
|
+
public Builder mergeFrom(final CodedInputStream input) throws IOException {
|
476
|
+
while (true) {
|
477
|
+
final int tag = input.readTag();
|
478
|
+
if (tag == 0 || !mergeFieldFrom(tag, input)) {
|
479
|
+
break;
|
480
|
+
}
|
481
|
+
}
|
482
|
+
return this;
|
483
|
+
}
|
484
|
+
|
485
|
+
/**
|
486
|
+
* Parse a single field from {@code input} and merge it into this set.
|
487
|
+
* @param tag The field's tag number, which was already parsed.
|
488
|
+
* @return {@code false} if the tag is an end group tag.
|
489
|
+
*/
|
490
|
+
public boolean mergeFieldFrom(final int tag, final CodedInputStream input)
|
491
|
+
throws IOException {
|
492
|
+
final int number = WireFormat.getTagFieldNumber(tag);
|
493
|
+
switch (WireFormat.getTagWireType(tag)) {
|
494
|
+
case WireFormat.WIRETYPE_VARINT:
|
495
|
+
getFieldBuilder(number).addVarint(input.readInt64());
|
496
|
+
return true;
|
497
|
+
case WireFormat.WIRETYPE_FIXED64:
|
498
|
+
getFieldBuilder(number).addFixed64(input.readFixed64());
|
499
|
+
return true;
|
500
|
+
case WireFormat.WIRETYPE_LENGTH_DELIMITED:
|
501
|
+
getFieldBuilder(number).addLengthDelimited(input.readBytes());
|
502
|
+
return true;
|
503
|
+
case WireFormat.WIRETYPE_START_GROUP:
|
504
|
+
final Builder subBuilder = newBuilder();
|
505
|
+
input.readGroup(number, subBuilder,
|
506
|
+
ExtensionRegistry.getEmptyRegistry());
|
507
|
+
getFieldBuilder(number).addGroup(subBuilder.build());
|
508
|
+
return true;
|
509
|
+
case WireFormat.WIRETYPE_END_GROUP:
|
510
|
+
return false;
|
511
|
+
case WireFormat.WIRETYPE_FIXED32:
|
512
|
+
getFieldBuilder(number).addFixed32(input.readFixed32());
|
513
|
+
return true;
|
514
|
+
default:
|
515
|
+
throw InvalidProtocolBufferException.invalidWireType();
|
516
|
+
}
|
517
|
+
}
|
518
|
+
|
519
|
+
/**
|
520
|
+
* Parse {@code data} as an {@code UnknownFieldSet} and merge it with the
|
521
|
+
* set being built. This is just a small wrapper around
|
522
|
+
* {@link #mergeFrom(CodedInputStream)}.
|
523
|
+
*/
|
524
|
+
public Builder mergeFrom(final ByteString data)
|
525
|
+
throws InvalidProtocolBufferException {
|
526
|
+
try {
|
527
|
+
final CodedInputStream input = data.newCodedInput();
|
528
|
+
mergeFrom(input);
|
529
|
+
input.checkLastTagWas(0);
|
530
|
+
return this;
|
531
|
+
} catch (final InvalidProtocolBufferException e) {
|
532
|
+
throw e;
|
533
|
+
} catch (final IOException e) {
|
534
|
+
throw new RuntimeException(
|
535
|
+
"Reading from a ByteString threw an IOException (should " +
|
536
|
+
"never happen).", e);
|
537
|
+
}
|
538
|
+
}
|
539
|
+
|
540
|
+
/**
|
541
|
+
* Parse {@code data} as an {@code UnknownFieldSet} and merge it with the
|
542
|
+
* set being built. This is just a small wrapper around
|
543
|
+
* {@link #mergeFrom(CodedInputStream)}.
|
544
|
+
*/
|
545
|
+
public Builder mergeFrom(final byte[] data)
|
546
|
+
throws InvalidProtocolBufferException {
|
547
|
+
try {
|
548
|
+
final CodedInputStream input = CodedInputStream.newInstance(data);
|
549
|
+
mergeFrom(input);
|
550
|
+
input.checkLastTagWas(0);
|
551
|
+
return this;
|
552
|
+
} catch (final InvalidProtocolBufferException e) {
|
553
|
+
throw e;
|
554
|
+
} catch (final IOException e) {
|
555
|
+
throw new RuntimeException(
|
556
|
+
"Reading from a byte array threw an IOException (should " +
|
557
|
+
"never happen).", e);
|
558
|
+
}
|
559
|
+
}
|
560
|
+
|
561
|
+
/**
|
562
|
+
* Parse an {@code UnknownFieldSet} from {@code input} and merge it with the
|
563
|
+
* set being built. This is just a small wrapper around
|
564
|
+
* {@link #mergeFrom(CodedInputStream)}.
|
565
|
+
*/
|
566
|
+
public Builder mergeFrom(final InputStream input) throws IOException {
|
567
|
+
final CodedInputStream codedInput = CodedInputStream.newInstance(input);
|
568
|
+
mergeFrom(codedInput);
|
569
|
+
codedInput.checkLastTagWas(0);
|
570
|
+
return this;
|
571
|
+
}
|
572
|
+
|
573
|
+
public boolean mergeDelimitedFrom(InputStream input)
|
574
|
+
throws IOException {
|
575
|
+
final int firstByte = input.read();
|
576
|
+
if (firstByte == -1) {
|
577
|
+
return false;
|
578
|
+
}
|
579
|
+
final int size = CodedInputStream.readRawVarint32(firstByte, input);
|
580
|
+
final InputStream limitedInput = new LimitedInputStream(input, size);
|
581
|
+
mergeFrom(limitedInput);
|
582
|
+
return true;
|
583
|
+
}
|
584
|
+
|
585
|
+
public boolean mergeDelimitedFrom(
|
586
|
+
InputStream input,
|
587
|
+
ExtensionRegistryLite extensionRegistry) throws IOException {
|
588
|
+
// UnknownFieldSet has no extensions.
|
589
|
+
return mergeDelimitedFrom(input);
|
590
|
+
}
|
591
|
+
|
592
|
+
public Builder mergeFrom(
|
593
|
+
CodedInputStream input,
|
594
|
+
ExtensionRegistryLite extensionRegistry) throws IOException {
|
595
|
+
// UnknownFieldSet has no extensions.
|
596
|
+
return mergeFrom(input);
|
597
|
+
}
|
598
|
+
|
599
|
+
public Builder mergeFrom(
|
600
|
+
ByteString data,
|
601
|
+
ExtensionRegistryLite extensionRegistry)
|
602
|
+
throws InvalidProtocolBufferException {
|
603
|
+
// UnknownFieldSet has no extensions.
|
604
|
+
return mergeFrom(data);
|
605
|
+
}
|
606
|
+
|
607
|
+
public Builder mergeFrom(byte[] data, int off, int len)
|
608
|
+
throws InvalidProtocolBufferException {
|
609
|
+
try {
|
610
|
+
final CodedInputStream input =
|
611
|
+
CodedInputStream.newInstance(data, off, len);
|
612
|
+
mergeFrom(input);
|
613
|
+
input.checkLastTagWas(0);
|
614
|
+
return this;
|
615
|
+
} catch (InvalidProtocolBufferException e) {
|
616
|
+
throw e;
|
617
|
+
} catch (IOException e) {
|
618
|
+
throw new RuntimeException(
|
619
|
+
"Reading from a byte array threw an IOException (should " +
|
620
|
+
"never happen).", e);
|
621
|
+
}
|
622
|
+
}
|
623
|
+
|
624
|
+
public Builder mergeFrom(
|
625
|
+
byte[] data,
|
626
|
+
ExtensionRegistryLite extensionRegistry)
|
627
|
+
throws InvalidProtocolBufferException {
|
628
|
+
// UnknownFieldSet has no extensions.
|
629
|
+
return mergeFrom(data);
|
630
|
+
}
|
631
|
+
|
632
|
+
public Builder mergeFrom(
|
633
|
+
byte[] data, int off, int len,
|
634
|
+
ExtensionRegistryLite extensionRegistry)
|
635
|
+
throws InvalidProtocolBufferException {
|
636
|
+
// UnknownFieldSet has no extensions.
|
637
|
+
return mergeFrom(data, off, len);
|
638
|
+
}
|
639
|
+
|
640
|
+
public Builder mergeFrom(
|
641
|
+
InputStream input,
|
642
|
+
ExtensionRegistryLite extensionRegistry) throws IOException {
|
643
|
+
// UnknownFieldSet has no extensions.
|
644
|
+
return mergeFrom(input);
|
645
|
+
}
|
646
|
+
|
647
|
+
public boolean isInitialized() {
|
648
|
+
// UnknownFieldSets do not have required fields, so they are always
|
649
|
+
// initialized.
|
650
|
+
return true;
|
651
|
+
}
|
652
|
+
}
|
653
|
+
|
654
|
+
/**
|
655
|
+
* Represents a single field in an {@code UnknownFieldSet}.
|
656
|
+
*
|
657
|
+
* <p>A {@code Field} consists of five lists of values. The lists correspond
|
658
|
+
* to the five "wire types" used in the protocol buffer binary format.
|
659
|
+
* The wire type of each field can be determined from the encoded form alone,
|
660
|
+
* without knowing the field's declared type. So, we are able to parse
|
661
|
+
* unknown values at least this far and separate them. Normally, only one
|
662
|
+
* of the five lists will contain any values, since it is impossible to
|
663
|
+
* define a valid message type that declares two different types for the
|
664
|
+
* same field number. However, the code is designed to allow for the case
|
665
|
+
* where the same unknown field number is encountered using multiple different
|
666
|
+
* wire types.
|
667
|
+
*
|
668
|
+
* <p>{@code Field} is an immutable class. To construct one, you must use a
|
669
|
+
* {@link Builder}.
|
670
|
+
*
|
671
|
+
* @see UnknownFieldSet
|
672
|
+
*/
|
673
|
+
public static final class Field {
|
674
|
+
private Field() {}
|
675
|
+
|
676
|
+
/** Construct a new {@link Builder}. */
|
677
|
+
public static Builder newBuilder() {
|
678
|
+
return Builder.create();
|
679
|
+
}
|
680
|
+
|
681
|
+
/**
|
682
|
+
* Construct a new {@link Builder} and initialize it to a copy of
|
683
|
+
* {@code copyFrom}.
|
684
|
+
*/
|
685
|
+
public static Builder newBuilder(final Field copyFrom) {
|
686
|
+
return newBuilder().mergeFrom(copyFrom);
|
687
|
+
}
|
688
|
+
|
689
|
+
/** Get an empty {@code Field}. */
|
690
|
+
public static Field getDefaultInstance() {
|
691
|
+
return fieldDefaultInstance;
|
692
|
+
}
|
693
|
+
private static final Field fieldDefaultInstance = newBuilder().build();
|
694
|
+
|
695
|
+
/** Get the list of varint values for this field. */
|
696
|
+
public List<Long> getVarintList() { return varint; }
|
697
|
+
|
698
|
+
/** Get the list of fixed32 values for this field. */
|
699
|
+
public List<Integer> getFixed32List() { return fixed32; }
|
700
|
+
|
701
|
+
/** Get the list of fixed64 values for this field. */
|
702
|
+
public List<Long> getFixed64List() { return fixed64; }
|
703
|
+
|
704
|
+
/** Get the list of length-delimited values for this field. */
|
705
|
+
public List<ByteString> getLengthDelimitedList() { return lengthDelimited; }
|
706
|
+
|
707
|
+
/**
|
708
|
+
* Get the list of embedded group values for this field. These are
|
709
|
+
* represented using {@link UnknownFieldSet}s rather than {@link Message}s
|
710
|
+
* since the group's type is presumably unknown.
|
711
|
+
*/
|
712
|
+
public List<UnknownFieldSet> getGroupList() { return group; }
|
713
|
+
|
714
|
+
@Override
|
715
|
+
public boolean equals(final Object other) {
|
716
|
+
if (this == other) {
|
717
|
+
return true;
|
718
|
+
}
|
719
|
+
if (!(other instanceof Field)) {
|
720
|
+
return false;
|
721
|
+
}
|
722
|
+
return Arrays.equals(getIdentityArray(),
|
723
|
+
((Field) other).getIdentityArray());
|
724
|
+
}
|
725
|
+
|
726
|
+
@Override
|
727
|
+
public int hashCode() {
|
728
|
+
return Arrays.hashCode(getIdentityArray());
|
729
|
+
}
|
730
|
+
|
731
|
+
/**
|
732
|
+
* Returns the array of objects to be used to uniquely identify this
|
733
|
+
* {@link Field} instance.
|
734
|
+
*/
|
735
|
+
private Object[] getIdentityArray() {
|
736
|
+
return new Object[] {
|
737
|
+
varint,
|
738
|
+
fixed32,
|
739
|
+
fixed64,
|
740
|
+
lengthDelimited,
|
741
|
+
group};
|
742
|
+
}
|
743
|
+
|
744
|
+
/**
|
745
|
+
* Serializes the field, including field number, and writes it to
|
746
|
+
* {@code output}.
|
747
|
+
*/
|
748
|
+
public void writeTo(final int fieldNumber, final CodedOutputStream output)
|
749
|
+
throws IOException {
|
750
|
+
for (final long value : varint) {
|
751
|
+
output.writeUInt64(fieldNumber, value);
|
752
|
+
}
|
753
|
+
for (final int value : fixed32) {
|
754
|
+
output.writeFixed32(fieldNumber, value);
|
755
|
+
}
|
756
|
+
for (final long value : fixed64) {
|
757
|
+
output.writeFixed64(fieldNumber, value);
|
758
|
+
}
|
759
|
+
for (final ByteString value : lengthDelimited) {
|
760
|
+
output.writeBytes(fieldNumber, value);
|
761
|
+
}
|
762
|
+
for (final UnknownFieldSet value : group) {
|
763
|
+
output.writeGroup(fieldNumber, value);
|
764
|
+
}
|
765
|
+
}
|
766
|
+
|
767
|
+
/**
|
768
|
+
* Get the number of bytes required to encode this field, including field
|
769
|
+
* number.
|
770
|
+
*/
|
771
|
+
public int getSerializedSize(final int fieldNumber) {
|
772
|
+
int result = 0;
|
773
|
+
for (final long value : varint) {
|
774
|
+
result += CodedOutputStream.computeUInt64Size(fieldNumber, value);
|
775
|
+
}
|
776
|
+
for (final int value : fixed32) {
|
777
|
+
result += CodedOutputStream.computeFixed32Size(fieldNumber, value);
|
778
|
+
}
|
779
|
+
for (final long value : fixed64) {
|
780
|
+
result += CodedOutputStream.computeFixed64Size(fieldNumber, value);
|
781
|
+
}
|
782
|
+
for (final ByteString value : lengthDelimited) {
|
783
|
+
result += CodedOutputStream.computeBytesSize(fieldNumber, value);
|
784
|
+
}
|
785
|
+
for (final UnknownFieldSet value : group) {
|
786
|
+
result += CodedOutputStream.computeGroupSize(fieldNumber, value);
|
787
|
+
}
|
788
|
+
return result;
|
789
|
+
}
|
790
|
+
|
791
|
+
/**
|
792
|
+
* Serializes the field, including field number, and writes it to
|
793
|
+
* {@code output}, using {@code MessageSet} wire format.
|
794
|
+
*/
|
795
|
+
public void writeAsMessageSetExtensionTo(
|
796
|
+
final int fieldNumber,
|
797
|
+
final CodedOutputStream output)
|
798
|
+
throws IOException {
|
799
|
+
for (final ByteString value : lengthDelimited) {
|
800
|
+
output.writeRawMessageSetExtension(fieldNumber, value);
|
801
|
+
}
|
802
|
+
}
|
803
|
+
|
804
|
+
/**
|
805
|
+
* Get the number of bytes required to encode this field, including field
|
806
|
+
* number, using {@code MessageSet} wire format.
|
807
|
+
*/
|
808
|
+
public int getSerializedSizeAsMessageSetExtension(final int fieldNumber) {
|
809
|
+
int result = 0;
|
810
|
+
for (final ByteString value : lengthDelimited) {
|
811
|
+
result += CodedOutputStream.computeRawMessageSetExtensionSize(
|
812
|
+
fieldNumber, value);
|
813
|
+
}
|
814
|
+
return result;
|
815
|
+
}
|
816
|
+
|
817
|
+
private List<Long> varint;
|
818
|
+
private List<Integer> fixed32;
|
819
|
+
private List<Long> fixed64;
|
820
|
+
private List<ByteString> lengthDelimited;
|
821
|
+
private List<UnknownFieldSet> group;
|
822
|
+
|
823
|
+
/**
|
824
|
+
* Used to build a {@link Field} within an {@link UnknownFieldSet}.
|
825
|
+
*
|
826
|
+
* <p>Use {@link Field#newBuilder()} to construct a {@code Builder}.
|
827
|
+
*/
|
828
|
+
public static final class Builder {
|
829
|
+
// This constructor should never be called directly (except from 'create').
|
830
|
+
private Builder() {}
|
831
|
+
|
832
|
+
private static Builder create() {
|
833
|
+
Builder builder = new Builder();
|
834
|
+
builder.result = new Field();
|
835
|
+
return builder;
|
836
|
+
}
|
837
|
+
|
838
|
+
private Field result;
|
839
|
+
|
840
|
+
/**
|
841
|
+
* Build the field. After {@code build()} has been called, the
|
842
|
+
* {@code Builder} is no longer usable. Calling any other method will
|
843
|
+
* result in undefined behavior and can cause a
|
844
|
+
* {@code NullPointerException} to be thrown.
|
845
|
+
*/
|
846
|
+
public Field build() {
|
847
|
+
if (result.varint == null) {
|
848
|
+
result.varint = Collections.emptyList();
|
849
|
+
} else {
|
850
|
+
result.varint = Collections.unmodifiableList(result.varint);
|
851
|
+
}
|
852
|
+
if (result.fixed32 == null) {
|
853
|
+
result.fixed32 = Collections.emptyList();
|
854
|
+
} else {
|
855
|
+
result.fixed32 = Collections.unmodifiableList(result.fixed32);
|
856
|
+
}
|
857
|
+
if (result.fixed64 == null) {
|
858
|
+
result.fixed64 = Collections.emptyList();
|
859
|
+
} else {
|
860
|
+
result.fixed64 = Collections.unmodifiableList(result.fixed64);
|
861
|
+
}
|
862
|
+
if (result.lengthDelimited == null) {
|
863
|
+
result.lengthDelimited = Collections.emptyList();
|
864
|
+
} else {
|
865
|
+
result.lengthDelimited =
|
866
|
+
Collections.unmodifiableList(result.lengthDelimited);
|
867
|
+
}
|
868
|
+
if (result.group == null) {
|
869
|
+
result.group = Collections.emptyList();
|
870
|
+
} else {
|
871
|
+
result.group = Collections.unmodifiableList(result.group);
|
872
|
+
}
|
873
|
+
|
874
|
+
final Field returnMe = result;
|
875
|
+
result = null;
|
876
|
+
return returnMe;
|
877
|
+
}
|
878
|
+
|
879
|
+
/** Discard the field's contents. */
|
880
|
+
public Builder clear() {
|
881
|
+
result = new Field();
|
882
|
+
return this;
|
883
|
+
}
|
884
|
+
|
885
|
+
/**
|
886
|
+
* Merge the values in {@code other} into this field. For each list
|
887
|
+
* of values, {@code other}'s values are append to the ones in this
|
888
|
+
* field.
|
889
|
+
*/
|
890
|
+
public Builder mergeFrom(final Field other) {
|
891
|
+
if (!other.varint.isEmpty()) {
|
892
|
+
if (result.varint == null) {
|
893
|
+
result.varint = new ArrayList<Long>();
|
894
|
+
}
|
895
|
+
result.varint.addAll(other.varint);
|
896
|
+
}
|
897
|
+
if (!other.fixed32.isEmpty()) {
|
898
|
+
if (result.fixed32 == null) {
|
899
|
+
result.fixed32 = new ArrayList<Integer>();
|
900
|
+
}
|
901
|
+
result.fixed32.addAll(other.fixed32);
|
902
|
+
}
|
903
|
+
if (!other.fixed64.isEmpty()) {
|
904
|
+
if (result.fixed64 == null) {
|
905
|
+
result.fixed64 = new ArrayList<Long>();
|
906
|
+
}
|
907
|
+
result.fixed64.addAll(other.fixed64);
|
908
|
+
}
|
909
|
+
if (!other.lengthDelimited.isEmpty()) {
|
910
|
+
if (result.lengthDelimited == null) {
|
911
|
+
result.lengthDelimited = new ArrayList<ByteString>();
|
912
|
+
}
|
913
|
+
result.lengthDelimited.addAll(other.lengthDelimited);
|
914
|
+
}
|
915
|
+
if (!other.group.isEmpty()) {
|
916
|
+
if (result.group == null) {
|
917
|
+
result.group = new ArrayList<UnknownFieldSet>();
|
918
|
+
}
|
919
|
+
result.group.addAll(other.group);
|
920
|
+
}
|
921
|
+
return this;
|
922
|
+
}
|
923
|
+
|
924
|
+
/** Add a varint value. */
|
925
|
+
public Builder addVarint(final long value) {
|
926
|
+
if (result.varint == null) {
|
927
|
+
result.varint = new ArrayList<Long>();
|
928
|
+
}
|
929
|
+
result.varint.add(value);
|
930
|
+
return this;
|
931
|
+
}
|
932
|
+
|
933
|
+
/** Add a fixed32 value. */
|
934
|
+
public Builder addFixed32(final int value) {
|
935
|
+
if (result.fixed32 == null) {
|
936
|
+
result.fixed32 = new ArrayList<Integer>();
|
937
|
+
}
|
938
|
+
result.fixed32.add(value);
|
939
|
+
return this;
|
940
|
+
}
|
941
|
+
|
942
|
+
/** Add a fixed64 value. */
|
943
|
+
public Builder addFixed64(final long value) {
|
944
|
+
if (result.fixed64 == null) {
|
945
|
+
result.fixed64 = new ArrayList<Long>();
|
946
|
+
}
|
947
|
+
result.fixed64.add(value);
|
948
|
+
return this;
|
949
|
+
}
|
950
|
+
|
951
|
+
/** Add a length-delimited value. */
|
952
|
+
public Builder addLengthDelimited(final ByteString value) {
|
953
|
+
if (result.lengthDelimited == null) {
|
954
|
+
result.lengthDelimited = new ArrayList<ByteString>();
|
955
|
+
}
|
956
|
+
result.lengthDelimited.add(value);
|
957
|
+
return this;
|
958
|
+
}
|
959
|
+
|
960
|
+
/** Add an embedded group. */
|
961
|
+
public Builder addGroup(final UnknownFieldSet value) {
|
962
|
+
if (result.group == null) {
|
963
|
+
result.group = new ArrayList<UnknownFieldSet>();
|
964
|
+
}
|
965
|
+
result.group.add(value);
|
966
|
+
return this;
|
967
|
+
}
|
968
|
+
}
|
969
|
+
}
|
970
|
+
|
971
|
+
/**
|
972
|
+
* Parser to implement MessageLite interface.
|
973
|
+
*/
|
974
|
+
public static final class Parser extends AbstractParser<UnknownFieldSet> {
|
975
|
+
public UnknownFieldSet parsePartialFrom(
|
976
|
+
CodedInputStream input, ExtensionRegistryLite extensionRegistry)
|
977
|
+
throws InvalidProtocolBufferException {
|
978
|
+
Builder builder = newBuilder();
|
979
|
+
try {
|
980
|
+
builder.mergeFrom(input);
|
981
|
+
} catch (InvalidProtocolBufferException e) {
|
982
|
+
throw e.setUnfinishedMessage(builder.buildPartial());
|
983
|
+
} catch (IOException e) {
|
984
|
+
throw new InvalidProtocolBufferException(e.getMessage())
|
985
|
+
.setUnfinishedMessage(builder.buildPartial());
|
986
|
+
}
|
987
|
+
return builder.buildPartial();
|
988
|
+
}
|
989
|
+
}
|
990
|
+
|
991
|
+
private static final Parser PARSER = new Parser();
|
992
|
+
public final Parser getParserForType() {
|
993
|
+
return PARSER;
|
994
|
+
}
|
995
|
+
}
|