You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pekko.apache.org by fa...@apache.org on 2023/08/01 10:36:03 UTC
[incubator-pekko] branch main updated: remove shaded protobuf-java v2 jar (pekko-protobuf) (#489)
This is an automated email from the ASF dual-hosted git repository.
fanningpj pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-pekko.git
The following commit(s) were added to refs/heads/main by this push:
new 964dcf53eb remove shaded protobuf-java v2 jar (pekko-protobuf) (#489)
964dcf53eb is described below
commit 964dcf53eb9a81a65944a1b1d51575091fe0a031
Author: PJ Fanning <pj...@users.noreply.github.com>
AuthorDate: Tue Aug 1 11:35:58 2023 +0100
remove shaded protobuf-java v2 jar (pekko-protobuf) (#489)
* remove protobuf v2 support
* Update OSGi.scala
* ci issue
* remove refs to pekko-protobuf classes
* fix comment
* update comments
* Update Serialization.scala
---
.github/workflows/scala3-build.yml | 2 +-
.github/workflows/scala3-compile.yml | 2 +-
LICENSE | 6 -
actor/src/main/resources/reference.conf | 1 -
.../apache/pekko/serialization/Serialization.scala | 6 +-
build.sbt | 11 -
legal/pekko-protobuf-jar-license.txt | 207 -
project/AddMetaInfLicenseFiles.scala | 13 -
project/OSGi.scala | 2 -
project/PekkoDisciplinePlugin.scala | 2 -
.../org/apache/pekko/protobuf/AbstractMessage.java | 943 -
.../apache/pekko/protobuf/AbstractMessageLite.java | 356 -
.../org/apache/pekko/protobuf/AbstractParser.java | 266 -
.../apache/pekko/protobuf/BlockingRpcChannel.java | 64 -
.../org/apache/pekko/protobuf/BlockingService.java | 77 -
.../apache/pekko/protobuf/BoundedByteString.java | 176 -
.../java/org/apache/pekko/protobuf/ByteString.java | 979 -
.../apache/pekko/protobuf/CodedInputStream.java | 933 -
.../apache/pekko/protobuf/CodedOutputStream.java | 1119 -
.../apache/pekko/protobuf/DescriptorProtos.java | 28513 -------------------
.../org/apache/pekko/protobuf/Descriptors.java | 1983 --
.../org/apache/pekko/protobuf/DynamicMessage.java | 495 -
.../apache/pekko/protobuf/ExtensionRegistry.java | 279 -
.../pekko/protobuf/ExtensionRegistryLite.java | 198 -
.../java/org/apache/pekko/protobuf/FieldSet.java | 874 -
.../apache/pekko/protobuf/GeneratedMessage.java | 1958 --
.../pekko/protobuf/GeneratedMessageLite.java | 747 -
.../java/org/apache/pekko/protobuf/Internal.java | 166 -
.../protobuf/InvalidProtocolBufferException.java | 127 -
.../java/org/apache/pekko/protobuf/LazyField.java | 223 -
.../apache/pekko/protobuf/LazyStringArrayList.java | 191 -
.../org/apache/pekko/protobuf/LazyStringList.java | 94 -
.../apache/pekko/protobuf/LiteralByteString.java | 362 -
.../java/org/apache/pekko/protobuf/Message.java | 250 -
.../org/apache/pekko/protobuf/MessageLite.java | 332 -
.../pekko/protobuf/MessageLiteOrBuilder.java | 73 -
.../apache/pekko/protobuf/MessageOrBuilder.java | 142 -
.../java/org/apache/pekko/protobuf/Parser.java | 272 -
.../apache/pekko/protobuf/ProtocolMessageEnum.java | 71 -
.../pekko/protobuf/RepeatedFieldBuilder.java | 709 -
.../org/apache/pekko/protobuf/RopeByteString.java | 956 -
.../org/apache/pekko/protobuf/RpcCallback.java | 60 -
.../java/org/apache/pekko/protobuf/RpcChannel.java | 84 -
.../org/apache/pekko/protobuf/RpcController.java | 131 -
.../java/org/apache/pekko/protobuf/RpcUtil.java | 148 -
.../java/org/apache/pekko/protobuf/Service.java | 130 -
.../apache/pekko/protobuf/ServiceException.java | 65 -
.../apache/pekko/protobuf/SingleFieldBuilder.java | 254 -
.../org/apache/pekko/protobuf/SmallSortedMap.java | 631 -
.../java/org/apache/pekko/protobuf/TextFormat.java | 1572 -
.../protobuf/UninitializedMessageException.java | 112 -
.../org/apache/pekko/protobuf/UnknownFieldSet.java | 991 -
.../pekko/protobuf/UnmodifiableLazyStringList.java | 165 -
.../main/java/org/apache/pekko/protobuf/Utf8.java | 362 -
.../java/org/apache/pekko/protobuf/WireFormat.java | 176 -
remote/src/main/resources/reference.conf | 9 -
.../remote/serialization/ProtobufSerializer.scala | 4 +-
.../serialization/ProtobufSerializerSpec.scala | 1 -
58 files changed, 6 insertions(+), 49069 deletions(-)
diff --git a/.github/workflows/scala3-build.yml b/.github/workflows/scala3-build.yml
index a9e3784327..8a6c2e3492 100644
--- a/.github/workflows/scala3-build.yml
+++ b/.github/workflows/scala3-build.yml
@@ -30,7 +30,7 @@ jobs:
- serialization-jackson/test
- stream/test stream-testkit/test stream-tests/test stream-typed/test
- stream-tests-tck/test
- - remote/test remote-tests/test protobuf/test protobuf-v3/test
+ - remote/test remote-tests/test protobuf-v3/test
fail-fast: true
steps:
- name: Checkout
diff --git a/.github/workflows/scala3-compile.yml b/.github/workflows/scala3-compile.yml
index f16748ecc8..922ed67ee0 100644
--- a/.github/workflows/scala3-compile.yml
+++ b/.github/workflows/scala3-compile.yml
@@ -28,7 +28,7 @@ jobs:
- serialization-jackson/Test/compile
- stream/Test/compile stream-testkit/Test/compile stream-tests/Test/compile stream-typed/Test/compile
- stream-tests-tck/Test/compile
- - remote/Test/compile remote-tests/Test/compile protobuf/Test/compile protobuf-v3/Test/compile
+ - remote/Test/compile remote-tests/Test/compile protobuf-v3/Test/compile
fail-fast: true
steps:
- name: Checkout
diff --git a/LICENSE b/LICENSE
index ec2dc50f3e..fc1ec51f45 100644
--- a/LICENSE
+++ b/LICENSE
@@ -353,12 +353,6 @@ Copyright 2014 - 2016 Real Logic Ltd.
---------------
-pekko-protobuf contains the sources of Google protobuf 2.5.0 runtime support,
-moved into the source package `org.apache.pekko.protobuf` so as to avoid version conflicts.
-For license information see COPYING.protobuf
-
----------------
-
pekko-persistence-typed contains AuctionEntity.java in its test source.
This code is derived from a class in Lagom <https://github.com/lagom>,
licensed under the Apache 2.0 license.
diff --git a/actor/src/main/resources/reference.conf b/actor/src/main/resources/reference.conf
index a2e01c016c..b625c5b260 100644
--- a/actor/src/main/resources/reference.conf
+++ b/actor/src/main/resources/reference.conf
@@ -800,7 +800,6 @@ pekko {
"com.google.protobuf.GeneratedMessage",
"com.google.protobuf.GeneratedMessageV3",
"scalapb.GeneratedMessageCompanion",
- "org.apache.pekko.protobuf.GeneratedMessage",
"org.apache.pekko.protobufv3.internal.GeneratedMessageV3"
]
diff --git a/actor/src/main/scala/org/apache/pekko/serialization/Serialization.scala b/actor/src/main/scala/org/apache/pekko/serialization/Serialization.scala
index 9c5b31bd62..76b5c2901d 100644
--- a/actor/src/main/scala/org/apache/pekko/serialization/Serialization.scala
+++ b/actor/src/main/scala/org/apache/pekko/serialization/Serialization.scala
@@ -447,7 +447,7 @@ class Serialization(val system: ExtendedActorSystem) extends Extension {
private[pekko] val bindings: immutable.Seq[ClassSerializer] = {
val fromConfig = for {
(className: String, alias: String) <- settings.SerializationBindings
- if alias != "none" && checkGoogleProtobuf(className) && checkPekkoProtobuf(className)
+ if alias != "none" && checkGoogleProtobuf(className)
} yield (system.dynamicAccess.getClassFor[Any](className).get, serializers(alias))
val fromSettings = serializerDetails.flatMap { detail =>
@@ -484,10 +484,6 @@ class Serialization(val system: ExtendedActorSystem) extends Extension {
// include "com.google.protobuf.GeneratedMessage" = proto in configured serialization-bindings.
private def checkGoogleProtobuf(className: String): Boolean = checkClass("com.google.protobuf", className)
- // pekko-protobuf is now not a dependency of remote so only load if user has explicitly added it
- // remove in v1.1
- private def checkPekkoProtobuf(className: String): Boolean = checkClass("org.apache.pekko.protobuf", className)
-
private def checkClass(prefix: String, className: String): Boolean =
!className.startsWith(prefix) || system.dynamicAccess.getClassFor[Any](className).isSuccess
diff --git a/build.sbt b/build.sbt
index 1fa18f4d64..d2c9633596 100644
--- a/build.sbt
+++ b/build.sbt
@@ -84,7 +84,6 @@ lazy val userProjects: Seq[ProjectReference] = List[ProjectReference](
persistenceQuery,
persistenceTyped,
persistenceTestkit,
- protobuf,
protobufV3,
pki,
remote,
@@ -116,7 +115,6 @@ lazy val root = Project(id = "pekko", base = file("."))
UnidocRoot.autoImport.unidocRootIgnoreProjects := Seq(
remoteTests,
benchJmh,
- protobuf,
protobufV3,
pekkoScalaNightly,
docs,
@@ -362,14 +360,6 @@ lazy val persistenceTypedTests = pekkoModule("persistence-typed-tests")
.disablePlugins(MimaPlugin)
.enablePlugins(NoPublish)
-lazy val protobuf = pekkoModule("protobuf")
- .settings(OSGi.protobuf)
- .settings(AutomaticModuleName.settings("pekko.protobuf"))
- .settings(AddMetaInfLicenseFiles.protobufSettings)
- .enablePlugins(ScaladocNoVerificationOfDiagrams)
- .disablePlugins(MimaPlugin)
- .settings(autoScalaLibrary := false) // Pure java project
-
lazy val protobufV3 = pekkoModule("protobuf-v3")
.settings(OSGi.protobufV3)
.settings(AutomaticModuleName.settings("pekko.protobuf.v3"))
@@ -413,7 +403,6 @@ lazy val remote =
actor,
stream,
pki,
- protobuf % "test",
actorTests % "test->test",
testkit % "test->test",
streamTestkit % "test",
diff --git a/legal/pekko-protobuf-jar-license.txt b/legal/pekko-protobuf-jar-license.txt
deleted file mode 100644
index d58aebf02a..0000000000
--- a/legal/pekko-protobuf-jar-license.txt
+++ /dev/null
@@ -1,207 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
----------------
-
-pekko-protobuf contains the sources of Google protobuf 2.5.0 runtime support,
-moved into the source package `org.apache.pekko.protobuf` so as to avoid version conflicts.
-For license information see COPYING.protobuf
diff --git a/project/AddMetaInfLicenseFiles.scala b/project/AddMetaInfLicenseFiles.scala
index 0a4532a2ed..94c89916d1 100644
--- a/project/AddMetaInfLicenseFiles.scala
+++ b/project/AddMetaInfLicenseFiles.scala
@@ -64,19 +64,6 @@ object AddMetaInfLicenseFiles extends AutoPlugin {
apacheSonatypeLicenseFile := baseDir.value / "legal" / "pekko-remote-jar-license.txt",
apacheSonatypeNoticeFile := baseDir.value / "legal" / "pekko-remote-jar-notice.txt")
- /**
- * Settings specific for Pekko protobuf subproject which requires a different license file
- * as well as an additional "COPYING.protobuf" file.
- */
- lazy val protobufSettings = Seq(
- apacheSonatypeLicenseFile := baseDir.value / "legal" / "pekko-protobuf-jar-license.txt") ++ inConfig(Compile)(Seq(
- resourceGenerators += {
- Def.task {
- List(
- ApacheSonatypePlugin.addFileToMetaInf(resourceManaged.value, baseDir.value / "COPYING.protobuf"))
- }
- }))
-
/**
* Settings specific for Pekko protobuf-v3 subproject which requires a different license file
* as well as an additional "COPYING.protobuf" file.
diff --git a/project/OSGi.scala b/project/OSGi.scala
index e3e8946199..bafd5ede1c 100644
--- a/project/OSGi.scala
+++ b/project/OSGi.scala
@@ -70,8 +70,6 @@ object OSGi {
val osgi = exports(Seq("org.apache.pekko.osgi.*"))
- val protobuf = exports(Seq("org.apache.pekko.protobuf.*"))
-
val protobufV3 = osgiSettings ++ Seq(
OsgiKeys.importPackage := Seq(
"!sun.misc",
diff --git a/project/PekkoDisciplinePlugin.scala b/project/PekkoDisciplinePlugin.scala
index 6c5ceefb8f..37c78170f9 100644
--- a/project/PekkoDisciplinePlugin.scala
+++ b/project/PekkoDisciplinePlugin.scala
@@ -32,8 +32,6 @@ object PekkoDisciplinePlugin extends AutoPlugin {
"pekko-actor-typed-tests",
// references to deprecated PARSER fields in generated message formats?
"pekko-cluster-typed",
- // use of deprecated org.apache.pekko.protobuf.GeneratedMessage
- "pekko-protobuf",
"pekko-protobuf-v3",
// references to deprecated PARSER fields in generated message formats?
"pekko-remote",
diff --git a/protobuf/src/main/java/org/apache/pekko/protobuf/AbstractMessage.java b/protobuf/src/main/java/org/apache/pekko/protobuf/AbstractMessage.java
deleted file mode 100644
index 595776a947..0000000000
--- a/protobuf/src/main/java/org/apache/pekko/protobuf/AbstractMessage.java
+++ /dev/null
@@ -1,943 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * license agreements; and to You under the Apache License, version 2.0:
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * This file is part of the Apache Pekko project, which was derived from Akka.
- */
-
-/*
- * Copyright (C) 2018-2022 Lightbend Inc. <https://www.lightbend.com>
- */
-
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package org.apache.pekko.protobuf;
-
-import org.apache.pekko.protobuf.Descriptors.Descriptor;
-import org.apache.pekko.protobuf.Descriptors.FieldDescriptor;
-import org.apache.pekko.protobuf.GeneratedMessage.ExtendableBuilder;
-import org.apache.pekko.protobuf.Internal.EnumLite;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-/**
- * A partial implementation of the {@link Message} interface which implements
- * as many methods of that interface as possible in terms of other methods.
- *
- * @author kenton@google.com Kenton Varda
- */
-public abstract class AbstractMessage extends AbstractMessageLite
- implements Message {
- @SuppressWarnings("unchecked")
- public boolean isInitialized() {
- // Check that all required fields are present.
- for (final FieldDescriptor field : getDescriptorForType().getFields()) {
- if (field.isRequired()) {
- if (!hasField(field)) {
- return false;
- }
- }
- }
-
- // Check that embedded messages are initialized.
- for (final Map.Entry<FieldDescriptor, Object> entry :
- getAllFields().entrySet()) {
- final FieldDescriptor field = entry.getKey();
- if (field.getJavaType() == FieldDescriptor.JavaType.MESSAGE) {
- if (field.isRepeated()) {
- for (final Message element : (List<Message>) entry.getValue()) {
- if (!element.isInitialized()) {
- return false;
- }
- }
- } else {
- if (!((Message) entry.getValue()).isInitialized()) {
- return false;
- }
- }
- }
- }
-
- return true;
- }
-
- public List<String> findInitializationErrors() {
- return Builder.findMissingFields(this);
- }
-
- public String getInitializationErrorString() {
- return delimitWithCommas(findInitializationErrors());
- }
-
- private static String delimitWithCommas(List<String> parts) {
- StringBuilder result = new StringBuilder();
- for (String part : parts) {
- if (result.length() > 0) {
- result.append(", ");
- }
- result.append(part);
- }
- return result.toString();
- }
-
- @Override
- public final String toString() {
- return TextFormat.printToString(this);
- }
-
- public void writeTo(final CodedOutputStream output) throws IOException {
- final boolean isMessageSet =
- getDescriptorForType().getOptions().getMessageSetWireFormat();
-
- for (final Map.Entry<FieldDescriptor, Object> entry :
- getAllFields().entrySet()) {
- final FieldDescriptor field = entry.getKey();
- final Object value = entry.getValue();
- if (isMessageSet && field.isExtension() &&
- field.getType() == FieldDescriptor.Type.MESSAGE &&
- !field.isRepeated()) {
- output.writeMessageSetExtension(field.getNumber(), (Message) value);
- } else {
- FieldSet.writeField(field, value, output);
- }
- }
-
- final UnknownFieldSet unknownFields = getUnknownFields();
- if (isMessageSet) {
- unknownFields.writeAsMessageSetTo(output);
- } else {
- unknownFields.writeTo(output);
- }
- }
-
- private int memoizedSize = -1;
-
- public int getSerializedSize() {
- int size = memoizedSize;
- if (size != -1) {
- return size;
- }
-
- size = 0;
- final boolean isMessageSet =
- getDescriptorForType().getOptions().getMessageSetWireFormat();
-
- for (final Map.Entry<FieldDescriptor, Object> entry :
- getAllFields().entrySet()) {
- final FieldDescriptor field = entry.getKey();
- final Object value = entry.getValue();
- if (isMessageSet && field.isExtension() &&
- field.getType() == FieldDescriptor.Type.MESSAGE &&
- !field.isRepeated()) {
- size += CodedOutputStream.computeMessageSetExtensionSize(
- field.getNumber(), (Message) value);
- } else {
- size += FieldSet.computeFieldSize(field, value);
- }
- }
-
- final UnknownFieldSet unknownFields = getUnknownFields();
- if (isMessageSet) {
- size += unknownFields.getSerializedSizeAsMessageSet();
- } else {
- size += unknownFields.getSerializedSize();
- }
-
- memoizedSize = size;
- return size;
- }
-
- @Override
- public boolean equals(final Object other) {
- if (other == this) {
- return true;
- }
- if (!(other instanceof Message)) {
- return false;
- }
- final Message otherMessage = (Message) other;
- if (getDescriptorForType() != otherMessage.getDescriptorForType()) {
- return false;
- }
- return getAllFields().equals(otherMessage.getAllFields()) &&
- getUnknownFields().equals(otherMessage.getUnknownFields());
- }
-
- @Override
- public int hashCode() {
- int hash = 41;
- hash = (19 * hash) + getDescriptorForType().hashCode();
- hash = hashFields(hash, getAllFields());
- hash = (29 * hash) + getUnknownFields().hashCode();
- return hash;
- }
-
- /** Get a hash code for given fields and values, using the given seed. */
- @SuppressWarnings("unchecked")
- protected int hashFields(int hash, Map<FieldDescriptor, Object> map) {
- for (Map.Entry<FieldDescriptor, Object> entry : map.entrySet()) {
- FieldDescriptor field = entry.getKey();
- Object value = entry.getValue();
- hash = (37 * hash) + field.getNumber();
- if (field.getType() != FieldDescriptor.Type.ENUM){
- hash = (53 * hash) + value.hashCode();
- } else if (field.isRepeated()) {
- List<? extends EnumLite> list = (List<? extends EnumLite>) value;
- hash = (53 * hash) + hashEnumList(list);
- } else {
- hash = (53 * hash) + hashEnum((EnumLite) value);
- }
- }
- return hash;
- }
-
- /**
- * Helper method for implementing {@link Message#hashCode()}.
- * @see Boolean#hashCode()
- */
- protected static int hashLong(long n) {
- return (int) (n ^ (n >>> 32));
- }
-
- /**
- * Helper method for implementing {@link Message#hashCode()}.
- * @see Boolean#hashCode()
- */
- protected static int hashBoolean(boolean b) {
- return b ? 1231 : 1237;
- }
-
- /**
- * Package private helper method for AbstractParser to create
- * UninitializedMessageException with missing field information.
- */
- @Override
- UninitializedMessageException newUninitializedMessageException() {
- return Builder.newUninitializedMessageException(this);
- }
-
- /**
- * Helper method for implementing {@link Message#hashCode()}.
- * <p>
- * This is needed because {@link java.lang.Enum#hashCode()} is final, but we
- * need to use the field number as the hash code to ensure compatibility
- * between statically and dynamically generated enum objects.
- */
- protected static int hashEnum(EnumLite e) {
- return e.getNumber();
- }
-
- /** Helper method for implementing {@link Message#hashCode()}. */
- protected static int hashEnumList(List<? extends EnumLite> list) {
- int hash = 1;
- for (EnumLite e : list) {
- hash = 31 * hash + hashEnum(e);
- }
- return hash;
- }
-
- // =================================================================
-
- /**
- * A partial implementation of the {@link Message.Builder} interface which
- * implements as many methods of that interface as possible in terms of
- * other methods.
- */
- @SuppressWarnings("unchecked")
- public static abstract class Builder<BuilderType extends Builder>
- extends AbstractMessageLite.Builder<BuilderType>
- implements Message.Builder {
- // The compiler produces an error if this is not declared explicitly.
- @Override
- public abstract BuilderType clone();
-
- public BuilderType clear() {
- for (final Map.Entry<FieldDescriptor, Object> entry :
- getAllFields().entrySet()) {
- clearField(entry.getKey());
- }
- return (BuilderType) this;
- }
-
- public List<String> findInitializationErrors() {
- return findMissingFields(this);
- }
-
- public String getInitializationErrorString() {
- return delimitWithCommas(findInitializationErrors());
- }
-
- public BuilderType mergeFrom(final Message other) {
- if (other.getDescriptorForType() != getDescriptorForType()) {
- throw new IllegalArgumentException(
- "mergeFrom(Message) can only merge messages of the same type.");
- }
-
- // Note: We don't attempt to verify that other's fields have valid
- // types. Doing so would be a losing battle. We'd have to verify
- // all sub-messages as well, and we'd have to make copies of all of
- // them to insure that they don't change after verification (since
- // the Message interface itself cannot enforce immutability of
- // implementations).
- // TODO(kenton): Provide a function somewhere called makeDeepCopy()
- // which allows people to make secure deep copies of messages.
-
- for (final Map.Entry<FieldDescriptor, Object> entry :
- other.getAllFields().entrySet()) {
- final FieldDescriptor field = entry.getKey();
- if (field.isRepeated()) {
- for (final Object element : (List)entry.getValue()) {
- addRepeatedField(field, element);
- }
- } else if (field.getJavaType() == FieldDescriptor.JavaType.MESSAGE) {
- final Message existingValue = (Message)getField(field);
- if (existingValue == existingValue.getDefaultInstanceForType()) {
- setField(field, entry.getValue());
- } else {
- setField(field,
- existingValue.newBuilderForType()
- .mergeFrom(existingValue)
- .mergeFrom((Message)entry.getValue())
- .build());
- }
- } else {
- setField(field, entry.getValue());
- }
- }
-
- mergeUnknownFields(other.getUnknownFields());
-
- return (BuilderType) this;
- }
-
- @Override
- public BuilderType mergeFrom(final CodedInputStream input)
- throws IOException {
- return mergeFrom(input, ExtensionRegistry.getEmptyRegistry());
- }
-
- @Override
- public BuilderType mergeFrom(
- final CodedInputStream input,
- final ExtensionRegistryLite extensionRegistry)
- throws IOException {
- final UnknownFieldSet.Builder unknownFields =
- UnknownFieldSet.newBuilder(getUnknownFields());
- while (true) {
- final int tag = input.readTag();
- if (tag == 0) {
- break;
- }
-
- if (!mergeFieldFrom(input, unknownFields, extensionRegistry,
- getDescriptorForType(), this, null, tag)) {
- // end group tag
- break;
- }
- }
- setUnknownFields(unknownFields.build());
- return (BuilderType) this;
- }
-
- /** helper method to handle {@code builder} and {@code extensions}. */
- private static void addRepeatedField(
- Message.Builder builder,
- FieldSet<FieldDescriptor> extensions,
- FieldDescriptor field,
- Object value) {
- if (builder != null) {
- builder.addRepeatedField(field, value);
- } else {
- extensions.addRepeatedField(field, value);
- }
- }
-
- /** helper method to handle {@code builder} and {@code extensions}. */
- private static void setField(
- Message.Builder builder,
- FieldSet<FieldDescriptor> extensions,
- FieldDescriptor field,
- Object value) {
- if (builder != null) {
- builder.setField(field, value);
- } else {
- extensions.setField(field, value);
- }
- }
-
- /** helper method to handle {@code builder} and {@code extensions}. */
- private static boolean hasOriginalMessage(
- Message.Builder builder,
- FieldSet<FieldDescriptor> extensions,
- FieldDescriptor field) {
- if (builder != null) {
- return builder.hasField(field);
- } else {
- return extensions.hasField(field);
- }
- }
-
- /** helper method to handle {@code builder} and {@code extensions}. */
- private static Message getOriginalMessage(
- Message.Builder builder,
- FieldSet<FieldDescriptor> extensions,
- FieldDescriptor field) {
- if (builder != null) {
- return (Message) builder.getField(field);
- } else {
- return (Message) extensions.getField(field);
- }
- }
-
- /** helper method to handle {@code builder} and {@code extensions}. */
- private static void mergeOriginalMessage(
- Message.Builder builder,
- FieldSet<FieldDescriptor> extensions,
- FieldDescriptor field,
- Message.Builder subBuilder) {
- Message originalMessage = getOriginalMessage(builder, extensions, field);
- if (originalMessage != null) {
- subBuilder.mergeFrom(originalMessage);
- }
- }
-
- /**
- * Like {@link #mergeFrom(CodedInputStream, ExtensionRegistryLite)}, but
- * parses a single field.
- *
- * When {@code builder} is not null, the method will parse and merge the
- * field into {@code builder}. Otherwise, it will try to parse the field
- * into {@code extensions}, when it's called by the parsing constructor in
- * generated classes.
- *
- * Package-private because it is used by GeneratedMessage.ExtendableMessage.
- * @param tag The tag, which should have already been read.
- * @return {@code true} unless the tag is an end-group tag.
- */
- static boolean mergeFieldFrom(
- CodedInputStream input,
- UnknownFieldSet.Builder unknownFields,
- ExtensionRegistryLite extensionRegistry,
- Descriptor type,
- Message.Builder builder,
- FieldSet<FieldDescriptor> extensions,
- int tag) throws IOException {
- if (type.getOptions().getMessageSetWireFormat() &&
- tag == WireFormat.MESSAGE_SET_ITEM_TAG) {
- mergeMessageSetExtensionFromCodedStream(
- input, unknownFields, extensionRegistry, type, builder, extensions);
- return true;
- }
-
- final int wireType = WireFormat.getTagWireType(tag);
- final int fieldNumber = WireFormat.getTagFieldNumber(tag);
-
- final FieldDescriptor field;
- Message defaultInstance = null;
-
- if (type.isExtensionNumber(fieldNumber)) {
- // extensionRegistry may be either ExtensionRegistry or
- // ExtensionRegistryLite. Since the type we are parsing is a full
- // message, only a full ExtensionRegistry could possibly contain
- // extensions of it. Otherwise we will treat the registry as if it
- // were empty.
- if (extensionRegistry instanceof ExtensionRegistry) {
- final ExtensionRegistry.ExtensionInfo extension =
- ((ExtensionRegistry) extensionRegistry)
- .findExtensionByNumber(type, fieldNumber);
- if (extension == null) {
- field = null;
- } else {
- field = extension.descriptor;
- defaultInstance = extension.defaultInstance;
- if (defaultInstance == null &&
- field.getJavaType() == FieldDescriptor.JavaType.MESSAGE) {
- throw new IllegalStateException(
- "Message-typed extension lacked default instance: " +
- field.getFullName());
- }
- }
- } else {
- field = null;
- }
- } else if (builder != null) {
- field = type.findFieldByNumber(fieldNumber);
- } else {
- field = null;
- }
-
- boolean unknown = false;
- boolean packed = false;
- if (field == null) {
- unknown = true; // Unknown field.
- } else if (wireType == FieldSet.getWireFormatForFieldType(
- field.getLiteType(),
- false /* isPacked */)) {
- packed = false;
- } else if (field.isPackable() &&
- wireType == FieldSet.getWireFormatForFieldType(
- field.getLiteType(),
- true /* isPacked */)) {
- packed = true;
- } else {
- unknown = true; // Unknown wire type.
- }
-
- if (unknown) { // Unknown field or wrong wire type. Skip.
- return unknownFields.mergeFieldFrom(tag, input);
- }
-
- if (packed) {
- final int length = input.readRawVarint32();
- final int limit = input.pushLimit(length);
- if (field.getLiteType() == WireFormat.FieldType.ENUM) {
- while (input.getBytesUntilLimit() > 0) {
- final int rawValue = input.readEnum();
- final Object value = field.getEnumType().findValueByNumber(rawValue);
- if (value == null) {
- // If the number isn't recognized as a valid value for this
- // enum, drop it (don't even add it to unknownFields).
- return true;
- }
- addRepeatedField(builder, extensions, field, value);
- }
- } else {
- while (input.getBytesUntilLimit() > 0) {
- final Object value =
- FieldSet.readPrimitiveField(input, field.getLiteType());
- addRepeatedField(builder, extensions, field, value);
- }
- }
- input.popLimit(limit);
- } else {
- final Object value;
- switch (field.getType()) {
- case GROUP: {
- final Message.Builder subBuilder;
- if (defaultInstance != null) {
- subBuilder = defaultInstance.newBuilderForType();
- } else {
- subBuilder = builder.newBuilderForField(field);
- }
- if (!field.isRepeated()) {
- mergeOriginalMessage(builder, extensions, field, subBuilder);
- }
- input.readGroup(field.getNumber(), subBuilder, extensionRegistry);
- value = subBuilder.buildPartial();
- break;
- }
- case MESSAGE: {
- final Message.Builder subBuilder;
- if (defaultInstance != null) {
- subBuilder = defaultInstance.newBuilderForType();
- } else {
- subBuilder = builder.newBuilderForField(field);
- }
- if (!field.isRepeated()) {
- mergeOriginalMessage(builder, extensions, field, subBuilder);
- }
- input.readMessage(subBuilder, extensionRegistry);
- value = subBuilder.buildPartial();
- break;
- }
- case ENUM:
- final int rawValue = input.readEnum();
- value = field.getEnumType().findValueByNumber(rawValue);
- // If the number isn't recognized as a valid value for this enum,
- // drop it.
- if (value == null) {
- unknownFields.mergeVarintField(fieldNumber, rawValue);
- return true;
- }
- break;
- default:
- value = FieldSet.readPrimitiveField(input, field.getLiteType());
- break;
- }
-
- if (field.isRepeated()) {
- addRepeatedField(builder, extensions, field, value);
- } else {
- setField(builder, extensions, field, value);
- }
- }
-
- return true;
- }
-
- /**
- * Called by {@code #mergeFieldFrom()} to parse a MessageSet extension.
- * If {@code builder} is not null, this method will merge MessageSet into
- * the builder. Otherwise, it will merge the MessageSet into {@code
- * extensions}.
- */
- private static void mergeMessageSetExtensionFromCodedStream(
- CodedInputStream input,
- UnknownFieldSet.Builder unknownFields,
- ExtensionRegistryLite extensionRegistry,
- Descriptor type,
- Message.Builder builder,
- FieldSet<FieldDescriptor> extensions) throws IOException {
-
- // The wire format for MessageSet is:
- // message MessageSet {
- // repeated group Item = 1 {
- // required int32 typeId = 2;
- // required bytes message = 3;
- // }
- // }
- // "typeId" is the extension's field number. The extension can only be
- // a message type, where "message" contains the encoded bytes of that
- // message.
- //
- // In practice, we will probably never see a MessageSet item in which
- // the message appears before the type ID, or where either field does not
- // appear exactly once. However, in theory such cases are valid, so we
- // should be prepared to accept them.
-
- int typeId = 0;
- ByteString rawBytes = null; // If we encounter "message" before "typeId"
- ExtensionRegistry.ExtensionInfo extension = null;
-
- // Read bytes from input, if we get it's type first then parse it eagerly,
- // otherwise we store the raw bytes in a local variable.
- while (true) {
- final int tag = input.readTag();
- if (tag == 0) {
- break;
- }
-
- if (tag == WireFormat.MESSAGE_SET_TYPE_ID_TAG) {
- typeId = input.readUInt32();
- if (typeId != 0) {
- // extensionRegistry may be either ExtensionRegistry or
- // ExtensionRegistryLite. Since the type we are parsing is a full
- // message, only a full ExtensionRegistry could possibly contain
- // extensions of it. Otherwise we will treat the registry as if it
- // were empty.
- if (extensionRegistry instanceof ExtensionRegistry) {
- extension = ((ExtensionRegistry) extensionRegistry)
- .findExtensionByNumber(type, typeId);
- }
- }
-
- } else if (tag == WireFormat.MESSAGE_SET_MESSAGE_TAG) {
- if (typeId != 0) {
- if (extension != null && ExtensionRegistryLite.isEagerlyParseMessageSets()) {
- // We already know the type, so we can parse directly from the
- // input with no copying. Hooray!
- eagerlyMergeMessageSetExtension(
- input, extension, extensionRegistry, builder, extensions);
- rawBytes = null;
- continue;
- }
- }
- // We haven't seen a type ID yet or we want parse message lazily.
- rawBytes = input.readBytes();
-
- } else { // Unknown tag. Skip it.
- if (!input.skipField(tag)) {
- break; // End of group
- }
- }
- }
- input.checkLastTagWas(WireFormat.MESSAGE_SET_ITEM_END_TAG);
-
- // Process the raw bytes.
- if (rawBytes != null && typeId != 0) { // Zero is not a valid type ID.
- if (extension != null) { // We known the type
- mergeMessageSetExtensionFromBytes(
- rawBytes, extension, extensionRegistry, builder, extensions);
- } else { // We don't know how to parse this. Ignore it.
- if (rawBytes != null) {
- unknownFields.mergeField(typeId, UnknownFieldSet.Field.newBuilder()
- .addLengthDelimited(rawBytes).build());
- }
- }
- }
- }
-
- private static void eagerlyMergeMessageSetExtension(
- CodedInputStream input,
- ExtensionRegistry.ExtensionInfo extension,
- ExtensionRegistryLite extensionRegistry,
- Message.Builder builder,
- FieldSet<FieldDescriptor> extensions) throws IOException {
-
- FieldDescriptor field = extension.descriptor;
- Message value = null;
- if (hasOriginalMessage(builder, extensions, field)) {
- Message originalMessage =
- getOriginalMessage(builder, extensions, field);
- Message.Builder subBuilder = originalMessage.toBuilder();
- input.readMessage(subBuilder, extensionRegistry);
- value = subBuilder.buildPartial();
- } else {
- value = input.readMessage(extension.defaultInstance.getParserForType(),
- extensionRegistry);
- }
-
- if (builder != null) {
- builder.setField(field, value);
- } else {
- extensions.setField(field, value);
- }
- }
-
- private static void mergeMessageSetExtensionFromBytes(
- ByteString rawBytes,
- ExtensionRegistry.ExtensionInfo extension,
- ExtensionRegistryLite extensionRegistry,
- Message.Builder builder,
- FieldSet<FieldDescriptor> extensions) throws IOException {
-
- FieldDescriptor field = extension.descriptor;
- boolean hasOriginalValue = hasOriginalMessage(builder, extensions, field);
-
- if (hasOriginalValue || ExtensionRegistryLite.isEagerlyParseMessageSets()) {
- // If the field already exists, we just parse the field.
- Message value = null;
- if (hasOriginalValue) {
- Message originalMessage =
- getOriginalMessage(builder, extensions, field);
- Message.Builder subBuilder= originalMessage.toBuilder();
- subBuilder.mergeFrom(rawBytes, extensionRegistry);
- value = subBuilder.buildPartial();
- } else {
- value = extension.defaultInstance.getParserForType()
- .parsePartialFrom(rawBytes, extensionRegistry);
- }
- setField(builder, extensions, field, value);
- } else {
- // Use LazyField to load MessageSet lazily.
- LazyField lazyField = new LazyField(
- extension.defaultInstance, extensionRegistry, rawBytes);
- if (builder != null) {
- // TODO(xiangl): it looks like this method can only be invoked by
- // ExtendableBuilder, but I'm not sure. So I double check the type of
- // builder here. It may be useless and need more investigation.
- if (builder instanceof ExtendableBuilder) {
- builder.setField(field, lazyField);
- } else {
- builder.setField(field, lazyField.getValue());
- }
- } else {
- extensions.setField(field, lazyField);
- }
- }
- }
-
- public BuilderType mergeUnknownFields(final UnknownFieldSet unknownFields) {
- setUnknownFields(
- UnknownFieldSet.newBuilder(getUnknownFields())
- .mergeFrom(unknownFields)
- .build());
- return (BuilderType) this;
- }
-
- public Message.Builder getFieldBuilder(final FieldDescriptor field) {
- throw new UnsupportedOperationException(
- "getFieldBuilder() called on an unsupported message type.");
- }
-
- /**
- * Construct an UninitializedMessageException reporting missing fields in
- * the given message.
- */
- protected static UninitializedMessageException
- newUninitializedMessageException(Message message) {
- return new UninitializedMessageException(findMissingFields(message));
- }
-
- /**
- * Populates {@code this.missingFields} with the full "path" of each
- * missing required field in the given message.
- */
- private static List<String> findMissingFields(
- final MessageOrBuilder message) {
- final List<String> results = new ArrayList<String>();
- findMissingFields(message, "", results);
- return results;
- }
-
- /** Recursive helper implementing {@link #findMissingFields(Message)}. */
- private static void findMissingFields(final MessageOrBuilder message,
- final String prefix,
- final List<String> results) {
- for (final FieldDescriptor field :
- message.getDescriptorForType().getFields()) {
- if (field.isRequired() && !message.hasField(field)) {
- results.add(prefix + field.getName());
- }
- }
-
- for (final Map.Entry<FieldDescriptor, Object> entry :
- message.getAllFields().entrySet()) {
- final FieldDescriptor field = entry.getKey();
- final Object value = entry.getValue();
-
- if (field.getJavaType() == FieldDescriptor.JavaType.MESSAGE) {
- if (field.isRepeated()) {
- int i = 0;
- for (final Object element : (List) value) {
- findMissingFields((MessageOrBuilder) element,
- subMessagePrefix(prefix, field, i++),
- results);
- }
- } else {
- if (message.hasField(field)) {
- findMissingFields((MessageOrBuilder) value,
- subMessagePrefix(prefix, field, -1),
- results);
- }
- }
- }
- }
- }
-
- private static String subMessagePrefix(final String prefix,
- final FieldDescriptor field,
- final int index) {
- final StringBuilder result = new StringBuilder(prefix);
- if (field.isExtension()) {
- result.append('(')
- .append(field.getFullName())
- .append(')');
- } else {
- result.append(field.getName());
- }
- if (index != -1) {
- result.append('[')
- .append(index)
- .append(']');
- }
- result.append('.');
- return result.toString();
- }
-
- // ===============================================================
- // The following definitions seem to be required in order to make javac
- // not produce weird errors like:
- //
- // java/com/google/protobuf/DynamicMessage.java:203: types
- // org.apache.pekko.protobuf.AbstractMessage.Builder<
- // org.apache.pekko.protobuf.DynamicMessage.Builder> and
- // org.apache.pekko.protobuf.AbstractMessage.Builder<
- // org.apache.pekko.protobuf.DynamicMessage.Builder> are incompatible; both
- // define mergeFrom(org.apache.pekko.protobuf.ByteString), but with unrelated
- // return types.
- //
- // Strangely, these lines are only needed if javac is invoked separately
- // on AbstractMessage.java and AbstractMessageLite.java. If javac is
- // invoked on both simultaneously, it works. (Or maybe the important
- // point is whether or not DynamicMessage.java is compiled together with
- // AbstractMessageLite.java -- not sure.) I suspect this is a compiler
- // bug.
-
- @Override
- public BuilderType mergeFrom(final ByteString data)
- throws InvalidProtocolBufferException {
- return super.mergeFrom(data);
- }
-
- @Override
- public BuilderType mergeFrom(
- final ByteString data,
- final ExtensionRegistryLite extensionRegistry)
- throws InvalidProtocolBufferException {
- return super.mergeFrom(data, extensionRegistry);
- }
-
- @Override
- public BuilderType mergeFrom(final byte[] data)
- throws InvalidProtocolBufferException {
- return super.mergeFrom(data);
- }
-
- @Override
- public BuilderType mergeFrom(
- final byte[] data, final int off, final int len)
- throws InvalidProtocolBufferException {
- return super.mergeFrom(data, off, len);
- }
-
- @Override
- public BuilderType mergeFrom(
- final byte[] data,
- final ExtensionRegistryLite extensionRegistry)
- throws InvalidProtocolBufferException {
- return super.mergeFrom(data, extensionRegistry);
- }
-
- @Override
- public BuilderType mergeFrom(
- final byte[] data, final int off, final int len,
- final ExtensionRegistryLite extensionRegistry)
- throws InvalidProtocolBufferException {
- return super.mergeFrom(data, off, len, extensionRegistry);
- }
-
- @Override
- public BuilderType mergeFrom(final InputStream input)
- throws IOException {
- return super.mergeFrom(input);
- }
-
- @Override
- public BuilderType mergeFrom(
- final InputStream input,
- final ExtensionRegistryLite extensionRegistry)
- throws IOException {
- return super.mergeFrom(input, extensionRegistry);
- }
-
- @Override
- public boolean mergeDelimitedFrom(final InputStream input)
- throws IOException {
- return super.mergeDelimitedFrom(input);
- }
-
- @Override
- public boolean mergeDelimitedFrom(
- final InputStream input,
- final ExtensionRegistryLite extensionRegistry)
- throws IOException {
- return super.mergeDelimitedFrom(input, extensionRegistry);
- }
-
- }
-}
diff --git a/protobuf/src/main/java/org/apache/pekko/protobuf/AbstractMessageLite.java b/protobuf/src/main/java/org/apache/pekko/protobuf/AbstractMessageLite.java
deleted file mode 100644
index eb6fc23248..0000000000
--- a/protobuf/src/main/java/org/apache/pekko/protobuf/AbstractMessageLite.java
+++ /dev/null
@@ -1,356 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * license agreements; and to You under the Apache License, version 2.0:
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * This file is part of the Apache Pekko project, which was derived from Akka.
- */
-
-/*
- * Copyright (C) 2018-2022 Lightbend Inc. <https://www.lightbend.com>
- */
-
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package org.apache.pekko.protobuf;
-
-import java.io.FilterInputStream;
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Collection;
-
-/**
- * A partial implementation of the {@link MessageLite} interface which
- * implements as many methods of that interface as possible in terms of other
- * methods.
- *
- * @author kenton@google.com Kenton Varda
- */
-public abstract class AbstractMessageLite implements MessageLite {
- public ByteString toByteString() {
- try {
- final ByteString.CodedBuilder out =
- ByteString.newCodedBuilder(getSerializedSize());
- writeTo(out.getCodedOutput());
- return out.build();
- } catch (IOException e) {
- throw new RuntimeException(
- "Serializing to a ByteString threw an IOException (should " +
- "never happen).", e);
- }
- }
-
- public byte[] toByteArray() {
- try {
- final byte[] result = new byte[getSerializedSize()];
- final CodedOutputStream output = CodedOutputStream.newInstance(result);
- writeTo(output);
- output.checkNoSpaceLeft();
- return result;
- } catch (IOException e) {
- throw new RuntimeException(
- "Serializing to a byte array threw an IOException " +
- "(should never happen).", e);
- }
- }
-
- public void writeTo(final OutputStream output) throws IOException {
- final int bufferSize =
- CodedOutputStream.computePreferredBufferSize(getSerializedSize());
- final CodedOutputStream codedOutput =
- CodedOutputStream.newInstance(output, bufferSize);
- writeTo(codedOutput);
- codedOutput.flush();
- }
-
- public void writeDelimitedTo(final OutputStream output) throws IOException {
- final int serialized = getSerializedSize();
- final int bufferSize = CodedOutputStream.computePreferredBufferSize(
- CodedOutputStream.computeRawVarint32Size(serialized) + serialized);
- final CodedOutputStream codedOutput =
- CodedOutputStream.newInstance(output, bufferSize);
- codedOutput.writeRawVarint32(serialized);
- writeTo(codedOutput);
- codedOutput.flush();
- }
-
- /**
- * Package private helper method for AbstractParser to create
- * UninitializedMessageException.
- */
- UninitializedMessageException newUninitializedMessageException() {
- return new UninitializedMessageException(this);
- }
-
- /**
- * A partial implementation of the {@link Message.Builder} interface which
- * implements as many methods of that interface as possible in terms of
- * other methods.
- */
- @SuppressWarnings("unchecked")
- public static abstract class Builder<BuilderType extends Builder>
- implements MessageLite.Builder {
- // The compiler produces an error if this is not declared explicitly.
- @Override
- public abstract BuilderType clone();
-
- public BuilderType mergeFrom(final CodedInputStream input)
- throws IOException {
- return mergeFrom(input, ExtensionRegistryLite.getEmptyRegistry());
- }
-
- // Re-defined here for return type covariance.
- public abstract BuilderType mergeFrom(
- final CodedInputStream input,
- final ExtensionRegistryLite extensionRegistry)
- throws IOException;
-
- public BuilderType mergeFrom(final ByteString data)
- throws InvalidProtocolBufferException {
- try {
- final CodedInputStream input = data.newCodedInput();
- mergeFrom(input);
- input.checkLastTagWas(0);
- return (BuilderType) this;
- } catch (InvalidProtocolBufferException e) {
- throw e;
- } catch (IOException e) {
- throw new RuntimeException(
- "Reading from a ByteString threw an IOException (should " +
- "never happen).", e);
- }
- }
-
- public BuilderType mergeFrom(
- final ByteString data,
- final ExtensionRegistryLite extensionRegistry)
- throws InvalidProtocolBufferException {
- try {
- final CodedInputStream input = data.newCodedInput();
- mergeFrom(input, extensionRegistry);
- input.checkLastTagWas(0);
- return (BuilderType) this;
- } catch (InvalidProtocolBufferException e) {
- throw e;
- } catch (IOException e) {
- throw new RuntimeException(
- "Reading from a ByteString threw an IOException (should " +
- "never happen).", e);
- }
- }
-
- public BuilderType mergeFrom(final byte[] data)
- throws InvalidProtocolBufferException {
- return mergeFrom(data, 0, data.length);
- }
-
- public BuilderType mergeFrom(final byte[] data, final int off,
- final int len)
- throws InvalidProtocolBufferException {
- try {
- final CodedInputStream input =
- CodedInputStream.newInstance(data, off, len);
- mergeFrom(input);
- input.checkLastTagWas(0);
- return (BuilderType) this;
- } catch (InvalidProtocolBufferException e) {
- throw e;
- } catch (IOException e) {
- throw new RuntimeException(
- "Reading from a byte array threw an IOException (should " +
- "never happen).", e);
- }
- }
-
- public BuilderType mergeFrom(
- final byte[] data,
- final ExtensionRegistryLite extensionRegistry)
- throws InvalidProtocolBufferException {
- return mergeFrom(data, 0, data.length, extensionRegistry);
- }
-
- public BuilderType mergeFrom(
- final byte[] data, final int off, final int len,
- final ExtensionRegistryLite extensionRegistry)
- throws InvalidProtocolBufferException {
- try {
- final CodedInputStream input =
- CodedInputStream.newInstance(data, off, len);
- mergeFrom(input, extensionRegistry);
- input.checkLastTagWas(0);
- return (BuilderType) this;
- } catch (InvalidProtocolBufferException e) {
- throw e;
- } catch (IOException e) {
- throw new RuntimeException(
- "Reading from a byte array threw an IOException (should " +
- "never happen).", e);
- }
- }
-
- public BuilderType mergeFrom(final InputStream input) throws IOException {
- final CodedInputStream codedInput = CodedInputStream.newInstance(input);
- mergeFrom(codedInput);
- codedInput.checkLastTagWas(0);
- return (BuilderType) this;
- }
-
- public BuilderType mergeFrom(
- final InputStream input,
- final ExtensionRegistryLite extensionRegistry)
- throws IOException {
- final CodedInputStream codedInput = CodedInputStream.newInstance(input);
- mergeFrom(codedInput, extensionRegistry);
- codedInput.checkLastTagWas(0);
- return (BuilderType) this;
- }
-
- /**
- * An InputStream implementations which reads from some other InputStream
- * but is limited to a particular number of bytes. Used by
- * mergeDelimitedFrom(). This is intentionally package-private so that
- * UnknownFieldSet can share it.
- */
- static final class LimitedInputStream extends FilterInputStream {
- private int limit;
-
- LimitedInputStream(InputStream in, int limit) {
- super(in);
- this.limit = limit;
- }
-
- @Override
- public int available() throws IOException {
- return Math.min(super.available(), limit);
- }
-
- @Override
- public int read() throws IOException {
- if (limit <= 0) {
- return -1;
- }
- final int result = super.read();
- if (result >= 0) {
- --limit;
- }
- return result;
- }
-
- @Override
- public int read(final byte[] b, final int off, int len)
- throws IOException {
- if (limit <= 0) {
- return -1;
- }
- len = Math.min(len, limit);
- final int result = super.read(b, off, len);
- if (result >= 0) {
- limit -= result;
- }
- return result;
- }
-
- @Override
- public long skip(final long n) throws IOException {
- final long result = super.skip(Math.min(n, limit));
- if (result >= 0) {
- limit -= result;
- }
- return result;
- }
- }
-
- public boolean mergeDelimitedFrom(
- final InputStream input,
- final ExtensionRegistryLite extensionRegistry)
- throws IOException {
- final int firstByte = input.read();
- if (firstByte == -1) {
- return false;
- }
- final int size = CodedInputStream.readRawVarint32(firstByte, input);
- final InputStream limitedInput = new LimitedInputStream(input, size);
- mergeFrom(limitedInput, extensionRegistry);
- return true;
- }
-
- public boolean mergeDelimitedFrom(final InputStream input)
- throws IOException {
- return mergeDelimitedFrom(input,
- ExtensionRegistryLite.getEmptyRegistry());
- }
-
- /**
- * Construct an UninitializedMessageException reporting missing fields in
- * the given message.
- */
- protected static UninitializedMessageException
- newUninitializedMessageException(MessageLite message) {
- return new UninitializedMessageException(message);
- }
-
- /**
- * Adds the {@code values} to the {@code list}. This is a helper method
- * used by generated code. Users should ignore it.
- *
- * @throws NullPointerException if any of the elements of {@code values} is
- * null.
- */
- protected static <T> void addAll(final Iterable<T> values,
- final Collection<? super T> list) {
- if (values instanceof LazyStringList) {
- // For StringOrByteStringLists, check the underlying elements to avoid
- // forcing conversions of ByteStrings to Strings.
- checkForNullValues(((LazyStringList) values).getUnderlyingElements());
- } else {
- checkForNullValues(values);
- }
- if (values instanceof Collection) {
- final Collection<T> collection = (Collection<T>) values;
- list.addAll(collection);
- } else {
- for (final T value : values) {
- list.add(value);
- }
- }
- }
-
- private static void checkForNullValues(final Iterable<?> values) {
- for (final Object value : values) {
- if (value == null) {
- throw new NullPointerException();
- }
- }
- }
- }
-}
diff --git a/protobuf/src/main/java/org/apache/pekko/protobuf/AbstractParser.java b/protobuf/src/main/java/org/apache/pekko/protobuf/AbstractParser.java
deleted file mode 100644
index 02ece3a607..0000000000
--- a/protobuf/src/main/java/org/apache/pekko/protobuf/AbstractParser.java
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * license agreements; and to You under the Apache License, version 2.0:
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * This file is part of the Apache Pekko project, which was derived from Akka.
- */
-
-/*
- * Copyright (C) 2018-2022 Lightbend Inc. <https://www.lightbend.com>
- */
-
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package org.apache.pekko.protobuf;
-
-import org.apache.pekko.protobuf.AbstractMessageLite.Builder.LimitedInputStream;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * A partial implementation of the {@link Parser} interface which implements
- * as many methods of that interface as possible in terms of other methods.
- *
- * Note: This class implements all the convenience methods in the
- * {@link Parser} interface. See {@link Parser} for related javadocs.
- * Subclasses need to implement
- * {@link Parser#parsePartialFrom(CodedInputStream, ExtensionRegistryLite)}
- *
- * @author liujisi@google.com (Pherl Liu)
- */
-public abstract class AbstractParser<MessageType extends MessageLite>
- implements Parser<MessageType> {
- /**
- * Creates an UninitializedMessageException for MessageType.
- */
- private UninitializedMessageException
- newUninitializedMessageException(MessageType message) {
- if (message instanceof AbstractMessageLite) {
- return ((AbstractMessageLite) message).newUninitializedMessageException();
- }
- return new UninitializedMessageException(message);
- }
-
- /**
- * Helper method to check if message is initialized.
- *
- * @throws InvalidProtocolBufferException if it is not initialized.
- * @return The message to check.
- */
- private MessageType checkMessageInitialized(MessageType message)
- throws InvalidProtocolBufferException {
- if (message != null && !message.isInitialized()) {
- throw newUninitializedMessageException(message)
- .asInvalidProtocolBufferException()
- .setUnfinishedMessage(message);
- }
- return message;
- }
-
- private static final ExtensionRegistryLite EMPTY_REGISTRY
- = ExtensionRegistryLite.getEmptyRegistry();
-
- public MessageType parsePartialFrom(CodedInputStream input)
- throws InvalidProtocolBufferException {
- return parsePartialFrom(input, EMPTY_REGISTRY);
- }
-
- public MessageType parseFrom(CodedInputStream input,
- ExtensionRegistryLite extensionRegistry)
- throws InvalidProtocolBufferException {
- return checkMessageInitialized(
- parsePartialFrom(input, extensionRegistry));
- }
-
- public MessageType parseFrom(CodedInputStream input)
- throws InvalidProtocolBufferException {
- return parseFrom(input, EMPTY_REGISTRY);
- }
-
- public MessageType parsePartialFrom(ByteString data,
- ExtensionRegistryLite extensionRegistry)
- throws InvalidProtocolBufferException {
- MessageType message;
- try {
- CodedInputStream input = data.newCodedInput();
- message = parsePartialFrom(input, extensionRegistry);
- try {
- input.checkLastTagWas(0);
- } catch (InvalidProtocolBufferException e) {
- throw e.setUnfinishedMessage(message);
- }
- return message;
- } catch (InvalidProtocolBufferException e) {
- throw e;
- }
- }
-
- public MessageType parsePartialFrom(ByteString data)
- throws InvalidProtocolBufferException {
- return parsePartialFrom(data, EMPTY_REGISTRY);
- }
-
- public MessageType parseFrom(ByteString data,
- ExtensionRegistryLite extensionRegistry)
- throws InvalidProtocolBufferException {
- return checkMessageInitialized(parsePartialFrom(data, extensionRegistry));
- }
-
- public MessageType parseFrom(ByteString data)
- throws InvalidProtocolBufferException {
- return parseFrom(data, EMPTY_REGISTRY);
- }
-
- public MessageType parsePartialFrom(byte[] data, int off, int len,
- ExtensionRegistryLite extensionRegistry)
- throws InvalidProtocolBufferException {
- try {
- CodedInputStream input = CodedInputStream.newInstance(data, off, len);
- MessageType message = parsePartialFrom(input, extensionRegistry);
- try {
- input.checkLastTagWas(0);
- } catch (InvalidProtocolBufferException e) {
- throw e.setUnfinishedMessage(message);
- }
- return message;
- } catch (InvalidProtocolBufferException e) {
- throw e;
- }
- }
-
- public MessageType parsePartialFrom(byte[] data, int off, int len)
- throws InvalidProtocolBufferException {
- return parsePartialFrom(data, off, len, EMPTY_REGISTRY);
- }
-
- public MessageType parsePartialFrom(byte[] data,
- ExtensionRegistryLite extensionRegistry)
- throws InvalidProtocolBufferException {
- return parsePartialFrom(data, 0, data.length, extensionRegistry);
- }
-
- public MessageType parsePartialFrom(byte[] data)
- throws InvalidProtocolBufferException {
- return parsePartialFrom(data, 0, data.length, EMPTY_REGISTRY);
- }
-
- public MessageType parseFrom(byte[] data, int off, int len,
- ExtensionRegistryLite extensionRegistry)
- throws InvalidProtocolBufferException {
- return checkMessageInitialized(
- parsePartialFrom(data, off, len, extensionRegistry));
- }
-
- public MessageType parseFrom(byte[] data, int off, int len)
- throws InvalidProtocolBufferException {
- return parseFrom(data, off, len, EMPTY_REGISTRY);
- }
-
- public MessageType parseFrom(byte[] data,
- ExtensionRegistryLite extensionRegistry)
- throws InvalidProtocolBufferException {
- return parseFrom(data, 0, data.length, extensionRegistry);
- }
-
- public MessageType parseFrom(byte[] data)
- throws InvalidProtocolBufferException {
- return parseFrom(data, EMPTY_REGISTRY);
- }
-
- public MessageType parsePartialFrom(InputStream input,
- ExtensionRegistryLite extensionRegistry)
- throws InvalidProtocolBufferException {
- CodedInputStream codedInput = CodedInputStream.newInstance(input);
- MessageType message = parsePartialFrom(codedInput, extensionRegistry);
- try {
- codedInput.checkLastTagWas(0);
- } catch (InvalidProtocolBufferException e) {
- throw e.setUnfinishedMessage(message);
- }
- return message;
- }
-
- public MessageType parsePartialFrom(InputStream input)
- throws InvalidProtocolBufferException {
- return parsePartialFrom(input, EMPTY_REGISTRY);
- }
-
- public MessageType parseFrom(InputStream input,
- ExtensionRegistryLite extensionRegistry)
- throws InvalidProtocolBufferException {
- return checkMessageInitialized(
- parsePartialFrom(input, extensionRegistry));
- }
-
- public MessageType parseFrom(InputStream input)
- throws InvalidProtocolBufferException {
- return parseFrom(input, EMPTY_REGISTRY);
- }
-
- public MessageType parsePartialDelimitedFrom(
- InputStream input,
- ExtensionRegistryLite extensionRegistry)
- throws InvalidProtocolBufferException {
- int size;
- try {
- int firstByte = input.read();
- if (firstByte == -1) {
- return null;
- }
- size = CodedInputStream.readRawVarint32(firstByte, input);
- } catch (IOException e) {
- throw new InvalidProtocolBufferException(e.getMessage());
- }
- InputStream limitedInput = new LimitedInputStream(input, size);
- return parsePartialFrom(limitedInput, extensionRegistry);
- }
-
- public MessageType parsePartialDelimitedFrom(InputStream input)
- throws InvalidProtocolBufferException {
- return parsePartialDelimitedFrom(input, EMPTY_REGISTRY);
- }
-
- public MessageType parseDelimitedFrom(
- InputStream input,
- ExtensionRegistryLite extensionRegistry)
- throws InvalidProtocolBufferException {
- return checkMessageInitialized(
- parsePartialDelimitedFrom(input, extensionRegistry));
- }
-
- public MessageType parseDelimitedFrom(InputStream input)
- throws InvalidProtocolBufferException {
- return parseDelimitedFrom(input, EMPTY_REGISTRY);
- }
-}
diff --git a/protobuf/src/main/java/org/apache/pekko/protobuf/BlockingRpcChannel.java b/protobuf/src/main/java/org/apache/pekko/protobuf/BlockingRpcChannel.java
deleted file mode 100644
index 1f0320d3f5..0000000000
--- a/protobuf/src/main/java/org/apache/pekko/protobuf/BlockingRpcChannel.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * license agreements; and to You under the Apache License, version 2.0:
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * This file is part of the Apache Pekko project, which was derived from Akka.
- */
-
-/*
- * Copyright (C) 2018-2022 Lightbend Inc. <https://www.lightbend.com>
- */
-
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package org.apache.pekko.protobuf;
-
-/**
- * <p>Abstract interface for a blocking RPC channel. {@code BlockingRpcChannel}
- * is the blocking equivalent to {@link RpcChannel}.
- *
- * @author kenton@google.com Kenton Varda
- * @author cpovirk@google.com Chris Povirk
- */
-public interface BlockingRpcChannel {
- /**
- * Call the given method of the remote service and blocks until it returns.
- * {@code callBlockingMethod()} is the blocking equivalent to
- * {@link RpcChannel#callMethod}.
- */
- Message callBlockingMethod(
- Descriptors.MethodDescriptor method,
- RpcController controller,
- Message request,
- Message responsePrototype) throws ServiceException;
-}
diff --git a/protobuf/src/main/java/org/apache/pekko/protobuf/BlockingService.java b/protobuf/src/main/java/org/apache/pekko/protobuf/BlockingService.java
deleted file mode 100644
index b4b331f0fb..0000000000
--- a/protobuf/src/main/java/org/apache/pekko/protobuf/BlockingService.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * license agreements; and to You under the Apache License, version 2.0:
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * This file is part of the Apache Pekko project, which was derived from Akka.
- */
-
-/*
- * Copyright (C) 2018-2022 Lightbend Inc. <https://www.lightbend.com>
- */
-
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package org.apache.pekko.protobuf;
-
-/**
- * Blocking equivalent to {@link Service}.
- *
- * @author kenton@google.com Kenton Varda
- * @author cpovirk@google.com Chris Povirk
- */
-public interface BlockingService {
- /**
- * Equivalent to {@link Service#getDescriptorForType}.
- */
- Descriptors.ServiceDescriptor getDescriptorForType();
-
- /**
- * Equivalent to {@link Service#callMethod}, except that
- * {@code callBlockingMethod()} returns the result of the RPC or throws a
- * {@link ServiceException} if there is a failure, rather than passing the
- * information to a callback.
- */
- Message callBlockingMethod(Descriptors.MethodDescriptor method,
- RpcController controller,
- Message request) throws ServiceException;
-
- /**
- * Equivalent to {@link Service#getRequestPrototype}.
- */
- Message getRequestPrototype(Descriptors.MethodDescriptor method);
-
- /**
- * Equivalent to {@link Service#getResponsePrototype}.
- */
- Message getResponsePrototype(Descriptors.MethodDescriptor method);
-}
diff --git a/protobuf/src/main/java/org/apache/pekko/protobuf/BoundedByteString.java b/protobuf/src/main/java/org/apache/pekko/protobuf/BoundedByteString.java
deleted file mode 100644
index dd73f791de..0000000000
--- a/protobuf/src/main/java/org/apache/pekko/protobuf/BoundedByteString.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * license agreements; and to You under the Apache License, version 2.0:
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * This file is part of the Apache Pekko project, which was derived from Akka.
- */
-
-/*
- * Copyright (C) 2018-2022 Lightbend Inc. <https://www.lightbend.com>
- */
-
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package org.apache.pekko.protobuf;
-
-import java.util.NoSuchElementException;
-
-/**
- * This class is used to represent the substring of a {@link ByteString} over a
- * single byte array. In terms of the public API of {@link ByteString}, you end
- * up here by calling {@link ByteString#copyFrom(byte[])} followed by {@link
- * ByteString#substring(int, int)}.
- *
- * <p>This class contains most of the overhead involved in creating a substring
- * from a {@link LiteralByteString}. The overhead involves some range-checking
- * and two extra fields.
- *
- * @author carlanton@google.com (Carl Haverl)
- */
-class BoundedByteString extends LiteralByteString {
-
- private final int bytesOffset;
- private final int bytesLength;
-
- /**
- * Creates a {@code BoundedByteString} backed by the sub-range of given array,
- * without copying.
- *
- * @param bytes array to wrap
- * @param offset index to first byte to use in bytes
- * @param length number of bytes to use from bytes
- * @throws IllegalArgumentException if {@code offset < 0}, {@code length < 0},
- * or if {@code offset + length >
- * bytes.length}.
- */
- BoundedByteString(byte[] bytes, int offset, int length) {
- super(bytes);
- if (offset < 0) {
- throw new IllegalArgumentException("Offset too small: " + offset);
- }
- if (length < 0) {
- throw new IllegalArgumentException("Length too small: " + offset);
- }
- if ((long) offset + length > bytes.length) {
- throw new IllegalArgumentException(
- "Offset+Length too large: " + offset + "+" + length);
- }
-
- this.bytesOffset = offset;
- this.bytesLength = length;
- }
-
- /**
- * Gets the byte at the given index.
- * Throws {@link ArrayIndexOutOfBoundsException}
- * for backwards-compatibility reasons although it would more properly be
- * {@link IndexOutOfBoundsException}.
- *
- * @param index index of byte
- * @return the value
- * @throws ArrayIndexOutOfBoundsException {@code index} is < 0 or >= size
- */
- @Override
- public byte byteAt(int index) {
- // We must check the index ourselves as we cannot rely on Java array index
- // checking for substrings.
- if (index < 0) {
- throw new ArrayIndexOutOfBoundsException("Index too small: " + index);
- }
- if (index >= size()) {
- throw new ArrayIndexOutOfBoundsException(
- "Index too large: " + index + ", " + size());
- }
-
- return bytes[bytesOffset + index];
- }
-
- @Override
- public int size() {
- return bytesLength;
- }
-
- @Override
- protected int getOffsetIntoBytes() {
- return bytesOffset;
- }
-
- // =================================================================
- // ByteString -> byte[]
-
- @Override
- protected void copyToInternal(byte[] target, int sourceOffset,
- int targetOffset, int numberToCopy) {
- System.arraycopy(bytes, getOffsetIntoBytes() + sourceOffset, target,
- targetOffset, numberToCopy);
- }
-
- // =================================================================
- // ByteIterator
-
- @Override
- public ByteIterator iterator() {
- return new BoundedByteIterator();
- }
-
- private class BoundedByteIterator implements ByteIterator {
-
- private int position;
- private final int limit;
-
- private BoundedByteIterator() {
- position = getOffsetIntoBytes();
- limit = position + size();
- }
-
- public boolean hasNext() {
- return (position < limit);
- }
-
- public Byte next() {
- // Boxing calls Byte.valueOf(byte), which does not instantiate.
- return nextByte();
- }
-
- public byte nextByte() {
- if (position >= limit) {
- throw new NoSuchElementException();
- }
- return bytes[position++];
- }
-
- public void remove() {
- throw new UnsupportedOperationException();
- }
- }
-}
diff --git a/protobuf/src/main/java/org/apache/pekko/protobuf/ByteString.java b/protobuf/src/main/java/org/apache/pekko/protobuf/ByteString.java
deleted file mode 100644
index 81da171c5d..0000000000
--- a/protobuf/src/main/java/org/apache/pekko/protobuf/ByteString.java
+++ /dev/null
@@ -1,979 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * license agreements; and to You under the Apache License, version 2.0:
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * This file is part of the Apache Pekko project, which was derived from Akka.
- */
-
-/*
- * Copyright (C) 2018-2022 Lightbend Inc. <https://www.lightbend.com>
- */
-
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package org.apache.pekko.protobuf;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-import java.nio.ByteBuffer;
-import java.nio.charset.StandardCharsets;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.NoSuchElementException;
-
-/**
- * Immutable sequence of bytes. Substring is supported by sharing the reference
- * to the immutable underlying bytes, as with {@link String}. Concatenation is
- * likewise supported without copying (long strings) by building a tree of
- * pieces in {@link RopeByteString}.
- * <p>
- * Like {@link String}, the contents of a {@link ByteString} can never be
- * observed to change, not even in the presence of a data race or incorrect
- * API usage in the client code.
- *
- * @author crazybob@google.com Bob Lee
- * @author kenton@google.com Kenton Varda
- * @author carlanton@google.com Carl Haverl
- * @author martinrb@google.com Martin Buchholz
- */
-public abstract class ByteString implements Iterable<Byte> {
-
- /**
- * When two strings to be concatenated have a combined length shorter than
- * this, we just copy their bytes on {@link #concat(ByteString)}.
- * The trade-off is copy size versus the overhead of creating tree nodes
- * in {@link RopeByteString}.
- */
- static final int CONCATENATE_BY_COPY_SIZE = 128;
-
- /**
- * When copying an InputStream into a ByteString with .readFrom(),
- * the chunks in the underlying rope start at 256 bytes, but double
- * each iteration up to 8192 bytes.
- */
- static final int MIN_READ_FROM_CHUNK_SIZE = 0x100; // 256b
- static final int MAX_READ_FROM_CHUNK_SIZE = 0x2000; // 8k
-
- /**
- * Empty {@code ByteString}.
- */
- public static final ByteString EMPTY = new LiteralByteString(new byte[0]);
-
- // This constructor is here to prevent subclassing outside of this package,
- ByteString() {}
-
- /**
- * Gets the byte at the given index. This method should be used only for
- * random access to individual bytes. To access bytes sequentially, use the
- * {@link ByteIterator} returned by {@link #iterator()}, and call {@link
- * #substring(int, int)} first if necessary.
- *
- * @param index index of byte
- * @return the value
- * @throws ArrayIndexOutOfBoundsException {@code index} is < 0 or ≥ size
- */
- public abstract byte byteAt(int index);
-
- /**
- * Return a {@link ByteString.ByteIterator} over the bytes in the ByteString.
- * To avoid auto-boxing, you may get the iterator manually and call
- * {@link ByteIterator#nextByte()}.
- *
- * @return the iterator
- */
- public abstract ByteIterator iterator();
-
- /**
- * This interface extends {@code Iterator<Byte>}, so that we can return an
- * unboxed {@code byte}.
- */
- public interface ByteIterator extends Iterator<Byte> {
- /**
- * An alternative to {@link Iterator#next()} that returns an
- * unboxed primitive {@code byte}.
- *
- * @return the next {@code byte} in the iteration
- * @throws NoSuchElementException if the iteration has no more elements
- */
- byte nextByte();
- }
-
- /**
- * Gets the number of bytes.
- *
- * @return size in bytes
- */
- public abstract int size();
-
- /**
- * Returns {@code true} if the size is {@code 0}, {@code false} otherwise.
- *
- * @return true if this is zero bytes long
- */
- public boolean isEmpty() {
- return size() == 0;
- }
-
- // =================================================================
- // ByteString -> substring
-
- /**
- * Return the substring from {@code beginIndex}, inclusive, to the end of the
- * string.
- *
- * @param beginIndex start at this index
- * @return substring sharing underlying data
- * @throws IndexOutOfBoundsException if {@code beginIndex < 0} or
- * {@code beginIndex > size()}.
- */
- public ByteString substring(int beginIndex) {
- return substring(beginIndex, size());
- }
-
- /**
- * Return the substring from {@code beginIndex}, inclusive, to {@code
- * endIndex}, exclusive.
- *
- * @param beginIndex start at this index
- * @param endIndex the last character is the one before this index
- * @return substring sharing underlying data
- * @throws IndexOutOfBoundsException if {@code beginIndex < 0},
- * {@code endIndex > size()}, or {@code beginIndex > endIndex}.
- */
- public abstract ByteString substring(int beginIndex, int endIndex);
-
- /**
- * Tests if this bytestring starts with the specified prefix.
- * Similar to {@link String#startsWith(String)}
- *
- * @param prefix the prefix.
- * @return <code>true</code> if the byte sequence represented by the
- * argument is a prefix of the byte sequence represented by
- * this string; <code>false</code> otherwise.
- */
- public boolean startsWith(ByteString prefix) {
- return size() >= prefix.size() &&
- substring(0, prefix.size()).equals(prefix);
- }
-
- // =================================================================
- // byte[] -> ByteString
-
- /**
- * Copies the given bytes into a {@code ByteString}.
- *
- * @param bytes source array
- * @param offset offset in source array
- * @param size number of bytes to copy
- * @return new {@code ByteString}
- */
- public static ByteString copyFrom(byte[] bytes, int offset, int size) {
- byte[] copy = new byte[size];
- System.arraycopy(bytes, offset, copy, 0, size);
- return new LiteralByteString(copy);
- }
-
- /**
- * Copies the given bytes into a {@code ByteString}.
- *
- * @param bytes to copy
- * @return new {@code ByteString}
- */
- public static ByteString copyFrom(byte[] bytes) {
- return copyFrom(bytes, 0, bytes.length);
- }
-
- /**
- * Copies the next {@code size} bytes from a {@code java.nio.ByteBuffer} into
- * a {@code ByteString}.
- *
- * @param bytes source buffer
- * @param size number of bytes to copy
- * @return new {@code ByteString}
- */
- public static ByteString copyFrom(ByteBuffer bytes, int size) {
- byte[] copy = new byte[size];
- bytes.get(copy);
- return new LiteralByteString(copy);
- }
-
- /**
- * Copies the remaining bytes from a {@code java.nio.ByteBuffer} into
- * a {@code ByteString}.
- *
- * @param bytes sourceBuffer
- * @return new {@code ByteString}
- */
- public static ByteString copyFrom(ByteBuffer bytes) {
- return copyFrom(bytes, bytes.remaining());
- }
-
- /**
- * Encodes {@code text} into a sequence of bytes using the named charset
- * and returns the result as a {@code ByteString}.
- *
- * @param text source string
- * @param charsetName encoding to use
- * @return new {@code ByteString}
- * @throws UnsupportedEncodingException if the encoding isn't found
- */
- public static ByteString copyFrom(String text, String charsetName)
- throws UnsupportedEncodingException {
- return new LiteralByteString(text.getBytes(charsetName));
- }
-
- /**
- * Encodes {@code text} into a sequence of UTF-8 bytes and returns the
- * result as a {@code ByteString}.
- *
- * @param text source string
- * @return new {@code ByteString}
- */
- public static ByteString copyFromUtf8(String text) {
- return new LiteralByteString(text.getBytes(StandardCharsets.UTF_8));
- }
-
- // =================================================================
- // InputStream -> ByteString
-
- /**
- * Completely reads the given stream's bytes into a
- * {@code ByteString}, blocking if necessary until all bytes are
- * read through to the end of the stream.
- *
- * <b>Performance notes:</b> The returned {@code ByteString} is an
- * immutable tree of byte arrays ("chunks") of the stream data. The
- * first chunk is small, with subsequent chunks each being double
- * the size, up to 8K. If the caller knows the precise length of
- * the stream and wishes to avoid all unnecessary copies and
- * allocations, consider using the two-argument version of this
- * method, below.
- *
- * @param streamToDrain The source stream, which is read completely
- * but not closed.
- * @return A new {@code ByteString} which is made up of chunks of
- * various sizes, depending on the behavior of the underlying
- * stream.
- * @throws IOException IOException is thrown if there is a problem
- * reading the underlying stream.
- */
- public static ByteString readFrom(InputStream streamToDrain)
- throws IOException {
- return readFrom(
- streamToDrain, MIN_READ_FROM_CHUNK_SIZE, MAX_READ_FROM_CHUNK_SIZE);
- }
-
- /**
- * Completely reads the given stream's bytes into a
- * {@code ByteString}, blocking if necessary until all bytes are
- * read through to the end of the stream.
- *
- * <b>Performance notes:</b> The returned {@code ByteString} is an
- * immutable tree of byte arrays ("chunks") of the stream data. The
- * chunkSize parameter sets the size of these byte arrays. In
- * particular, if the chunkSize is precisely the same as the length
- * of the stream, unnecessary allocations and copies will be
- * avoided. Otherwise, the chunks will be of the given size, except
- * for the last chunk, which will be resized (via a reallocation and
- * copy) to contain the remainder of the stream.
- *
- * @param streamToDrain The source stream, which is read completely
- * but not closed.
- * @param chunkSize The size of the chunks in which to read the
- * stream.
- * @return A new {@code ByteString} which is made up of chunks of
- * the given size.
- * @throws IOException IOException is thrown if there is a problem
- * reading the underlying stream.
- */
- public static ByteString readFrom(InputStream streamToDrain, int chunkSize)
- throws IOException {
- return readFrom(streamToDrain, chunkSize, chunkSize);
- }
-
- // Helper method that takes the chunk size range as a parameter.
- public static ByteString readFrom(InputStream streamToDrain, int minChunkSize,
- int maxChunkSize) throws IOException {
- Collection<ByteString> results = new ArrayList<>();
-
- // copy the inbound bytes into a list of chunks; the chunk size
- // grows exponentially to support both short and long streams.
- int chunkSize = minChunkSize;
- while (true) {
- ByteString chunk = readChunk(streamToDrain, chunkSize);
- if (chunk == null) {
- break;
- }
- results.add(chunk);
- chunkSize = Math.min(chunkSize * 2, maxChunkSize);
- }
-
- return ByteString.copyFrom(results);
- }
-
- /**
- * Blocks until a chunk of the given size can be made from the
- * stream, or EOF is reached. Calls read() repeatedly in case the
- * given stream implementation doesn't completely fill the given
- * buffer in one read() call.
- *
- * @return A chunk of the desired size, or else a chunk as large as
- * was available when end of stream was reached. Returns null if the
- * given stream had no more data in it.
- */
- private static ByteString readChunk(InputStream in, final int chunkSize)
- throws IOException {
- final byte[] buf = new byte[chunkSize];
- int bytesRead = 0;
- while (bytesRead < chunkSize) {
- final int count = in.read(buf, bytesRead, chunkSize - bytesRead);
- if (count == -1) {
- break;
- }
- bytesRead += count;
- }
-
- if (bytesRead == 0) {
- return null;
- } else {
- return ByteString.copyFrom(buf, 0, bytesRead);
- }
- }
-
- // =================================================================
- // Multiple ByteStrings -> One ByteString
-
- /**
- * Concatenate the given {@code ByteString} to this one. Short concatenations,
- * of total size smaller than {@link ByteString#CONCATENATE_BY_COPY_SIZE}, are
- * produced by copying the underlying bytes (as per Rope.java, <a
- * href="https://www.cs.ubc.ca/local/reading/proceedings/spe91-95/spe/vol25/issue12/spe986.pdf">
- * BAP95 </a>. In general, the concatenate involves no copying.
- *
- * @param other string to concatenate
- * @return a new {@code ByteString} instance
- */
- public ByteString concat(ByteString other) {
- int thisSize = size();
- int otherSize = other.size();
- if ((long) thisSize + otherSize >= Integer.MAX_VALUE) {
- throw new IllegalArgumentException("ByteString would be too long: " +
- thisSize + "+" + otherSize);
- }
-
- return RopeByteString.concatenate(this, other);
- }
-
- /**
- * Concatenates all byte strings in the iterable and returns the result.
- * This is designed to run in O(list size), not O(total bytes).
- *
- * <p>The returned {@code ByteString} is not necessarily a unique object.
- * If the list is empty, the returned object is the singleton empty
- * {@code ByteString}. If the list has only one element, that
- * {@code ByteString} will be returned without copying.
- *
- * @param byteStrings strings to be concatenated
- * @return new {@code ByteString}
- */
- public static ByteString copyFrom(Iterable<ByteString> byteStrings) {
- Collection<ByteString> collection;
- if (!(byteStrings instanceof Collection)) {
- collection = new ArrayList<>();
- for (ByteString byteString : byteStrings) {
- collection.add(byteString);
- }
- } else {
- collection = (Collection<ByteString>) byteStrings;
- }
- ByteString result;
- if (collection.isEmpty()) {
- result = EMPTY;
- } else {
- result = balancedConcat(collection.iterator(), collection.size());
- }
- return result;
- }
-
- // Internal function used by copyFrom(Iterable<ByteString>).
- // Create a balanced concatenation of the next "length" elements from the
- // iterable.
- private static ByteString balancedConcat(Iterator<ByteString> iterator,
- int length) {
- assert length >= 1;
- ByteString result;
- if (length == 1) {
- result = iterator.next();
- } else {
- int halfLength = length >>> 1;
- ByteString left = balancedConcat(iterator, halfLength);
- ByteString right = balancedConcat(iterator, length - halfLength);
- result = left.concat(right);
- }
- return result;
- }
-
- // =================================================================
- // ByteString -> byte[]
-
- /**
- * Copies bytes into a buffer at the given offset.
- *
- * @param target buffer to copy into
- * @param offset in the target buffer
- * @throws IndexOutOfBoundsException if the offset is negative or too large
- */
- public void copyTo(byte[] target, int offset) {
- copyTo(target, 0, offset, size());
- }
-
- /**
- * Copies bytes into a buffer.
- *
- * @param target buffer to copy into
- * @param sourceOffset offset within these bytes
- * @param targetOffset offset within the target buffer
- * @param numberToCopy number of bytes to copy
- * @throws IndexOutOfBoundsException if an offset or size is negative or too
- * large
- */
- public void copyTo(byte[] target, int sourceOffset, int targetOffset,
- int numberToCopy) {
- if (sourceOffset < 0) {
- throw new IndexOutOfBoundsException("Source offset < 0: " + sourceOffset);
- }
- if (targetOffset < 0) {
- throw new IndexOutOfBoundsException("Target offset < 0: " + targetOffset);
- }
- if (numberToCopy < 0) {
- throw new IndexOutOfBoundsException("Length < 0: " + numberToCopy);
- }
- if (sourceOffset + numberToCopy > size()) {
- throw new IndexOutOfBoundsException(
- "Source end offset < 0: " + (sourceOffset + numberToCopy));
- }
- if (targetOffset + numberToCopy > target.length) {
- throw new IndexOutOfBoundsException(
- "Target end offset < 0: " + (targetOffset + numberToCopy));
- }
- if (numberToCopy > 0) {
- copyToInternal(target, sourceOffset, targetOffset, numberToCopy);
- }
- }
-
- /**
- * Internal (package private) implementation of <code>copyTo</code>.
- * It assumes that all error checking has already been performed and that
- * <code>numberToCopy > 0</code>.
- */
- protected abstract void copyToInternal(byte[] target, int sourceOffset,
- int targetOffset, int numberToCopy);
-
- /**
- * Copies bytes into a ByteBuffer.
- *
- * @param target ByteBuffer to copy into.
- * @throws java.nio.ReadOnlyBufferException if the {@code target} is read-only
- * @throws java.nio.BufferOverflowException if the {@code target}'s
- * remaining() space is not large enough to hold the data.
- */
- public abstract void copyTo(ByteBuffer target);
-
- /**
- * Copies bytes to a {@code byte[]}.
- *
- * @return copied bytes
- */
- public byte[] toByteArray() {
- int size = size();
- byte[] result = new byte[size];
- copyToInternal(result, 0, 0, size);
- return result;
- }
-
- /**
- * Writes the complete contents of this byte string to
- * the specified output stream argument.
- *
- * @param out the output stream to which to write the data.
- * @throws IOException if an I/O error occurs.
- */
- public abstract void writeTo(OutputStream out) throws IOException;
-
- /**
- * Constructs a read-only {@code java.nio.ByteBuffer} whose content
- * is equal to the contents of this byte string.
- * The result uses the same backing array as the byte string, if possible.
- *
- * @return wrapped bytes
- */
- public abstract ByteBuffer asReadOnlyByteBuffer();
-
- /**
- * Constructs a list of read-only {@code java.nio.ByteBuffer} objects
- * such that the concatenation of their contents is equal to the contents
- * of this byte string. The result uses the same backing arrays as the
- * byte string.
- * <p>
- * By returning a list, implementations of this method may be able to avoid
- * copying even when there are multiple backing arrays.
- *
- * @return a list of wrapped bytes
- */
- public abstract List<ByteBuffer> asReadOnlyByteBufferList();
-
- /**
- * Constructs a new {@code String} by decoding the bytes using the
- * specified charset.
- *
- * @param charsetName encode using this charset
- * @return new string
- * @throws UnsupportedEncodingException if charset isn't recognized
- */
- public abstract String toString(String charsetName)
- throws UnsupportedEncodingException;
-
- // =================================================================
- // UTF-8 decoding
-
- /**
- * Constructs a new {@code String} by decoding the bytes as UTF-8.
- *
- * @return new string using UTF-8 encoding
- */
- public String toStringUtf8() {
- try {
- return toString("UTF-8");
- } catch (UnsupportedEncodingException e) {
- throw new RuntimeException("UTF-8 not supported?", e);
- }
- }
-
- /**
- * Tells whether this {@code ByteString} represents a well-formed UTF-8
- * byte sequence, such that the original bytes can be converted to a
- * String object and then round tripped back to bytes without loss.
- *
- * <p>More precisely, returns {@code true} whenever: <pre> {@code
- * Arrays.equals(byteString.toByteArray(),
- * new String(byteString.toByteArray(), "UTF-8").getBytes("UTF-8"))
- * }</pre>
- *
- * <p>This method returns {@code false} for "overlong" byte sequences,
- * as well as for 3-byte sequences that would map to a surrogate
- * character, in accordance with the restricted definition of UTF-8
- * introduced in Unicode 3.1. Note that the UTF-8 decoder included in
- * Oracle's JDK has been modified to also reject "overlong" byte
- * sequences, but (as of 2011) still accepts 3-byte surrogate
- * character byte sequences.
- *
- * <p>See the Unicode Standard,<br>
- * Table 3-6. <em>UTF-8 Bit Distribution</em>,<br>
- * Table 3-7. <em>Well Formed UTF-8 Byte Sequences</em>.
- *
- * @return whether the bytes in this {@code ByteString} are a
- * well-formed UTF-8 byte sequence
- */
- public abstract boolean isValidUtf8();
-
- /**
- * Tells whether the given byte sequence is a well-formed, malformed, or
- * incomplete UTF-8 byte sequence. This method accepts and returns a partial
- * state result, allowing the bytes for a complete UTF-8 byte sequence to be
- * composed from multiple {@code ByteString} segments.
- *
- * @param state either {@code 0} (if this is the initial decoding operation)
- * or the value returned from a call to a partial decoding method for the
- * previous bytes
- * @param offset offset of the first byte to check
- * @param length number of bytes to check
- *
- * @return {@code -1} if the partial byte sequence is definitely malformed,
- * {@code 0} if it is well-formed (no additional input needed), or, if the
- * byte sequence is "incomplete", i.e. apparently terminated in the middle of
- * a character, an opaque integer "state" value containing enough information
- * to decode the character when passed to a subsequent invocation of a
- * partial decoding method.
- */
- protected abstract int partialIsValidUtf8(int state, int offset, int length);
-
- // =================================================================
- // equals() and hashCode()
-
- @Override
- public abstract boolean equals(Object o);
-
- /**
- * Return a non-zero hashCode depending only on the sequence of bytes
- * in this ByteString.
- *
- * @return hashCode value for this object
- */
- @Override
- public abstract int hashCode();
-
- // =================================================================
- // Input stream
-
- /**
- * Creates an {@code InputStream} which can be used to read the bytes.
- * <p>
- * The {@link InputStream} returned by this method is guaranteed to be
- * completely non-blocking. The method {@link InputStream#available()}
- * returns the number of bytes remaining in the stream. The methods
- * {@link InputStream#read(byte[])}, {@link InputStream#read(byte[],int,int)}
- * and {@link InputStream#skip(long)} will read/skip as many bytes as are
- * available.
- * <p>
- * The methods in the returned {@link InputStream} might <b>not</b> be
- * thread safe.
- *
- * @return an input stream that returns the bytes of this byte string.
- */
- public abstract InputStream newInput();
-
- /**
- * Creates a {@link CodedInputStream} which can be used to read the bytes.
- * Using this is often more efficient than creating a {@link CodedInputStream}
- * that wraps the result of {@link #newInput()}.
- *
- * @return stream based on wrapped data
- */
- public abstract CodedInputStream newCodedInput();
-
- // =================================================================
- // Output stream
-
- /**
- * Creates a new {@link Output} with the given initial capacity. Call {@link
- * Output#toByteString()} to create the {@code ByteString} instance.
- * <p>
- * A {@link ByteString.Output} offers the same functionality as a
- * {@link ByteArrayOutputStream}, except that it returns a {@link ByteString}
- * rather than a {@code byte} array.
- *
- * @param initialCapacity estimate of number of bytes to be written
- * @return {@code OutputStream} for building a {@code ByteString}
- */
- public static Output newOutput(int initialCapacity) {
- return new Output(initialCapacity);
- }
-
- /**
- * Creates a new {@link Output}. Call {@link Output#toByteString()} to create
- * the {@code ByteString} instance.
- * <p>
- * A {@link ByteString.Output} offers the same functionality as a
- * {@link ByteArrayOutputStream}, except that it returns a {@link ByteString}
- * rather than a {@code byte array}.
- *
- * @return {@code OutputStream} for building a {@code ByteString}
- */
- public static Output newOutput() {
- return new Output(CONCATENATE_BY_COPY_SIZE);
- }
-
- /**
- * Outputs to a {@code ByteString} instance. Call {@link #toByteString()} to
- * create the {@code ByteString} instance.
- */
- public static final class Output extends OutputStream {
- // Implementation note.
- // The public methods of this class must be synchronized. ByteStrings
- // are guaranteed to be immutable. Without some sort of locking, it could
- // be possible for one thread to call toByteSring(), while another thread
- // is still modifying the underlying byte array.
-
- private static final byte[] EMPTY_BYTE_ARRAY = new byte[0];
- // argument passed by user, indicating initial capacity.
- private final int initialCapacity;
- // ByteStrings to be concatenated to create the result
- private final ArrayList<ByteString> flushedBuffers;
- // Total number of bytes in the ByteStrings of flushedBuffers
- private int flushedBuffersTotalBytes;
- // Current buffer to which we are writing
- private byte[] buffer;
- // Location in buffer[] to which we write the next byte.
- private int bufferPos;
-
- /**
- * Creates a new ByteString output stream with the specified
- * initial capacity.
- *
- * @param initialCapacity the initial capacity of the output stream.
- */
- Output(int initialCapacity) {
- if (initialCapacity < 0) {
- throw new IllegalArgumentException("Buffer size < 0");
- }
- this.initialCapacity = initialCapacity;
- this.flushedBuffers = new ArrayList<>();
- this.buffer = new byte[initialCapacity];
- }
-
- @Override
- public synchronized void write(int b) {
- if (bufferPos == buffer.length) {
- flushFullBuffer(1);
- }
- buffer[bufferPos++] = (byte)b;
- }
-
- @Override
- public synchronized void write(byte[] b, int offset, int length) {
- if (length <= buffer.length - bufferPos) {
- // The bytes can fit into the current buffer.
- System.arraycopy(b, offset, buffer, bufferPos, length);
- bufferPos += length;
- } else {
- // Use up the current buffer
- int copySize = buffer.length - bufferPos;
- System.arraycopy(b, offset, buffer, bufferPos, copySize);
- offset += copySize;
- length -= copySize;
- // Flush the buffer, and get a new buffer at least big enough to cover
- // what we still need to output
- flushFullBuffer(length);
- System.arraycopy(b, offset, buffer, 0 /* count */, length);
- bufferPos = length;
- }
- }
-
- /**
- * Creates a byte string. Its size is the current size of this output
- * stream and its output has been copied to it.
- *
- * @return the current contents of this output stream, as a byte string.
- */
- public synchronized ByteString toByteString() {
- flushLastBuffer();
- return ByteString.copyFrom(flushedBuffers);
- }
-
- /**
- * Implement java.util.Arrays.copyOf() for jdk 1.5.
- */
- private byte[] copyArray(byte[] buffer, int length) {
- byte[] result = new byte[length];
- System.arraycopy(buffer, 0, result, 0, Math.min(buffer.length, length));
- return result;
- }
-
- /**
- * Writes the complete contents of this byte array output stream to
- * the specified output stream argument.
- *
- * @param out the output stream to which to write the data.
- * @throws IOException if an I/O error occurs.
- */
- public void writeTo(OutputStream out) throws IOException {
- ByteString[] cachedFlushBuffers;
- byte[] cachedBuffer;
- int cachedBufferPos;
- synchronized (this) {
- // Copy the information we need into local variables so as to hold
- // the lock for as short a time as possible.
- cachedFlushBuffers =
- flushedBuffers.toArray(new ByteString[flushedBuffers.size()]);
- cachedBuffer = buffer;
- cachedBufferPos = bufferPos;
- }
- for (ByteString byteString : cachedFlushBuffers) {
- byteString.writeTo(out);
- }
-
- out.write(copyArray(cachedBuffer, cachedBufferPos));
- }
-
- /**
- * Returns the current size of the output stream.
- *
- * @return the current size of the output stream
- */
- public synchronized int size() {
- return flushedBuffersTotalBytes + bufferPos;
- }
-
- /**
- * Resets this stream, so that all currently accumulated output in the
- * output stream is discarded. The output stream can be used again,
- * reusing the already allocated buffer space.
- */
- public synchronized void reset() {
- flushedBuffers.clear();
- flushedBuffersTotalBytes = 0;
- bufferPos = 0;
- }
-
- @Override
- public String toString() {
- return String.format("<ByteString.Output@%s size=%d>",
- Integer.toHexString(System.identityHashCode(this)), size());
- }
-
- /**
- * Internal function used by writers. The current buffer is full, and the
- * writer needs a new buffer whose size is at least the specified minimum
- * size.
- */
- private void flushFullBuffer(int minSize) {
- flushedBuffers.add(new LiteralByteString(buffer));
- flushedBuffersTotalBytes += buffer.length;
- // We want to increase our total capacity by 50%, but as a minimum,
- // the new buffer should also at least be >= minSize and
- // >= initial Capacity.
- int newSize = Math.max(initialCapacity,
- Math.max(minSize, flushedBuffersTotalBytes >>> 1));
- buffer = new byte[newSize];
- bufferPos = 0;
- }
-
- /**
- * Internal function used by {@link #toByteString()}. The current buffer may
- * or may not be full, but it needs to be flushed.
- */
- private void flushLastBuffer() {
- if (bufferPos < buffer.length) {
- if (bufferPos > 0) {
- byte[] bufferCopy = copyArray(buffer, bufferPos);
- flushedBuffers.add(new LiteralByteString(bufferCopy));
- }
- // We reuse this buffer for further writes.
- } else {
- // Buffer is completely full. Huzzah.
- flushedBuffers.add(new LiteralByteString(buffer));
- // 99% of the time, we're not going to use this OutputStream again.
- // We set buffer to an empty byte stream so that we're handling this
- // case without wasting space. In the rare case that more writes
- // *do* occur, this empty buffer will be flushed and an appropriately
- // sized new buffer will be created.
- buffer = EMPTY_BYTE_ARRAY;
- }
- flushedBuffersTotalBytes += bufferPos;
- bufferPos = 0;
- }
- }
-
- /**
- * Constructs a new {@code ByteString} builder, which allows you to
- * efficiently construct a {@code ByteString} by writing to a {@link
- * CodedOutputStream}. Using this is much more efficient than calling {@code
- * newOutput()} and wrapping that in a {@code CodedOutputStream}.
- *
- * <p>This is package-private because it's a somewhat confusing interface.
- * Users can call {@link Message#toByteString()} instead of calling this
- * directly.
- *
- * @param size The target byte size of the {@code ByteString}. You must write
- * exactly this many bytes before building the result.
- * @return the builder
- */
- static CodedBuilder newCodedBuilder(int size) {
- return new CodedBuilder(size);
- }
-
- /** See {@link ByteString#newCodedBuilder(int)}. */
- static final class CodedBuilder {
- private final CodedOutputStream output;
- private final byte[] buffer;
-
- private CodedBuilder(int size) {
- buffer = new byte[size];
- output = CodedOutputStream.newInstance(buffer);
- }
-
- public ByteString build() {
- output.checkNoSpaceLeft();
-
- // We can be confident that the CodedOutputStream will not modify the
- // underlying bytes anymore because it already wrote all of them. So,
- // no need to make a copy.
- return new LiteralByteString(buffer);
- }
-
- public CodedOutputStream getCodedOutput() {
- return output;
- }
- }
-
- // =================================================================
- // Methods {@link RopeByteString} needs on instances, which aren't part of the
- // public API.
-
- /**
- * Return the depth of the tree representing this {@code ByteString}, if any,
- * whose root is this node. If this is a leaf node, return 0.
- *
- * @return tree depth or zero
- */
- protected abstract int getTreeDepth();
-
- /**
- * Return {@code true} if this ByteString is literal (a leaf node) or a
- * flat-enough tree in the sense of {@link RopeByteString}.
- *
- * @return true if the tree is flat enough
- */
- protected abstract boolean isBalanced();
-
- /**
- * Return the cached hash code if available.
- *
- * @return value of cached hash code or 0 if not computed yet
- */
- protected abstract int peekCachedHashCode();
-
- /**
- * Compute the hash across the value bytes starting with the given hash, and
- * return the result. This is used to compute the hash across strings
- * represented as a set of pieces by allowing the hash computation to be
- * continued from piece to piece.
- *
- * @param h starting hash value
- * @param offset offset into this value to start looking at data values
- * @param length number of data values to include in the hash computation
- * @return ending hash value
- */
- protected abstract int partialHash(int h, int offset, int length);
-
- @Override
- public String toString() {
- return String.format("<ByteString@%s size=%d>",
- Integer.toHexString(System.identityHashCode(this)), size());
- }
-}
diff --git a/protobuf/src/main/java/org/apache/pekko/protobuf/CodedInputStream.java b/protobuf/src/main/java/org/apache/pekko/protobuf/CodedInputStream.java
deleted file mode 100644
index 1f7ebf7e71..0000000000
--- a/protobuf/src/main/java/org/apache/pekko/protobuf/CodedInputStream.java
+++ /dev/null
@@ -1,933 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * license agreements; and to You under the Apache License, version 2.0:
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * This file is part of the Apache Pekko project, which was derived from Akka.
- */
-
-/*
- * Copyright (C) 2018-2022 Lightbend Inc. <https://www.lightbend.com>
- */
-
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package org.apache.pekko.protobuf;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Reads and decodes protocol message fields.
- *
- * This class contains two kinds of methods: methods that read specific
- * protocol message constructs and field types (e.g. {@link #readTag()} and
- * {@link #readInt32()}) and methods that read low-level values (e.g.
- * {@link #readRawVarint32()} and {@link #readRawBytes}). If you are reading
- * encoded protocol messages, you should use the former methods, but if you are
- * reading some other format of your own design, use the latter.
- *
- * @author kenton@google.com Kenton Varda
- */
-public final class CodedInputStream {
- /**
- * Create a new CodedInputStream wrapping the given InputStream.
- */
- public static CodedInputStream newInstance(final InputStream input) {
- return new CodedInputStream(input);
- }
-
- /**
- * Create a new CodedInputStream wrapping the given byte array.
- */
- public static CodedInputStream newInstance(final byte[] buf) {
- return newInstance(buf, 0, buf.length);
- }
-
- /**
- * Create a new CodedInputStream wrapping the given byte array slice.
- */
- public static CodedInputStream newInstance(final byte[] buf, final int off,
- final int len) {
- CodedInputStream result = new CodedInputStream(buf, off, len);
- try {
- // Some uses of CodedInputStream can be more efficient if they know
- // exactly how many bytes are available. By pushing the end point of the
- // buffer as a limit, we allow them to get this information via
- // getBytesUntilLimit(). Pushing a limit that we know is at the end of
- // the stream can never hurt, since we can never past that point anyway.
- result.pushLimit(len);
- } catch (InvalidProtocolBufferException ex) {
- // The only reason pushLimit() might throw an exception here is if len
- // is negative. Normally pushLimit()'s parameter comes directly off the
- // wire, so it's important to catch exceptions in case of corrupt or
- // malicious data. However, in this case, we expect that len is not a
- // user-supplied value, so we can assume that it being negative indicates
- // a programming error. Therefore, throwing an unchecked exception is
- // appropriate.
- throw new IllegalArgumentException(ex);
- }
- return result;
- }
-
- // -----------------------------------------------------------------
-
- /**
- * Attempt to read a field tag, returning zero if we have reached EOF.
- * Protocol message parsers use this to read tags, since a protocol message
- * may legally end wherever a tag occurs, and zero is not a valid tag number.
- */
- public int readTag() throws IOException {
- if (isAtEnd()) {
- lastTag = 0;
- return 0;
- }
-
- lastTag = readRawVarint32();
- if (WireFormat.getTagFieldNumber(lastTag) == 0) {
- // If we actually read zero (or any tag number corresponding to field
- // number zero), that's not a valid tag.
- throw InvalidProtocolBufferException.invalidTag();
- }
- return lastTag;
- }
-
- /**
- * Verifies that the last call to readTag() returned the given tag value.
- * This is used to verify that a nested group ended with the correct
- * end tag.
- *
- * @throws InvalidProtocolBufferException {@code value} does not match the
- * last tag.
- */
- public void checkLastTagWas(final int value)
- throws InvalidProtocolBufferException {
- if (lastTag != value) {
- throw InvalidProtocolBufferException.invalidEndTag();
- }
- }
-
- /**
- * Reads and discards a single field, given its tag value.
- *
- * @return {@code false} if the tag is an endgroup tag, in which case
- * nothing is skipped. Otherwise, returns {@code true}.
- */
- public boolean skipField(final int tag) throws IOException {
- switch (WireFormat.getTagWireType(tag)) {
- case WireFormat.WIRETYPE_VARINT:
- readInt32();
- return true;
- case WireFormat.WIRETYPE_FIXED64:
- readRawLittleEndian64();
- return true;
- case WireFormat.WIRETYPE_LENGTH_DELIMITED:
- skipRawBytes(readRawVarint32());
- return true;
- case WireFormat.WIRETYPE_START_GROUP:
- skipMessage();
- checkLastTagWas(
- WireFormat.makeTag(WireFormat.getTagFieldNumber(tag),
- WireFormat.WIRETYPE_END_GROUP));
- return true;
- case WireFormat.WIRETYPE_END_GROUP:
- return false;
- case WireFormat.WIRETYPE_FIXED32:
- readRawLittleEndian32();
- return true;
- default:
- throw InvalidProtocolBufferException.invalidWireType();
- }
- }
-
- /**
- * Reads and discards an entire message. This will read either until EOF
- * or until an endgroup tag, whichever comes first.
- */
- public void skipMessage() throws IOException {
- while (true) {
- final int tag = readTag();
- if (tag == 0 || !skipField(tag)) {
- return;
- }
- }
- }
-
- // -----------------------------------------------------------------
-
- /** Read a {@code double} field value from the stream. */
- public double readDouble() throws IOException {
- return Double.longBitsToDouble(readRawLittleEndian64());
- }
-
- /** Read a {@code float} field value from the stream. */
- public float readFloat() throws IOException {
- return Float.intBitsToFloat(readRawLittleEndian32());
- }
-
- /** Read a {@code uint64} field value from the stream. */
- public long readUInt64() throws IOException {
- return readRawVarint64();
- }
-
- /** Read an {@code int64} field value from the stream. */
- public long readInt64() throws IOException {
- return readRawVarint64();
- }
-
- /** Read an {@code int32} field value from the stream. */
- public int readInt32() throws IOException {
- return readRawVarint32();
- }
-
- /** Read a {@code fixed64} field value from the stream. */
- public long readFixed64() throws IOException {
- return readRawLittleEndian64();
- }
-
- /** Read a {@code fixed32} field value from the stream. */
- public int readFixed32() throws IOException {
- return readRawLittleEndian32();
- }
-
- /** Read a {@code bool} field value from the stream. */
- public boolean readBool() throws IOException {
- return readRawVarint32() != 0;
- }
-
- /** Read a {@code string} field value from the stream. */
- public String readString() throws IOException {
- final int size = readRawVarint32();
- if (size <= (bufferSize - bufferPos) && size > 0) {
- // Fast path: We already have the bytes in a contiguous buffer, so
- // just copy directly from it.
- final String result = new String(buffer, bufferPos, size, "UTF-8");
- bufferPos += size;
- return result;
- } else {
- // Slow path: Build a byte array first then copy it.
- return new String(readRawBytes(size), "UTF-8");
- }
- }
-
- /** Read a {@code group} field value from the stream. */
- public void readGroup(final int fieldNumber,
- final MessageLite.Builder builder,
- final ExtensionRegistryLite extensionRegistry)
- throws IOException {
- if (recursionDepth >= recursionLimit) {
- throw InvalidProtocolBufferException.recursionLimitExceeded();
- }
- ++recursionDepth;
- builder.mergeFrom(this, extensionRegistry);
- checkLastTagWas(
- WireFormat.makeTag(fieldNumber, WireFormat.WIRETYPE_END_GROUP));
- --recursionDepth;
- }
-
- /** Read a {@code group} field value from the stream. */
- public <T extends MessageLite> T readGroup(
- final int fieldNumber,
- final Parser<T> parser,
- final ExtensionRegistryLite extensionRegistry)
- throws IOException {
- if (recursionDepth >= recursionLimit) {
- throw InvalidProtocolBufferException.recursionLimitExceeded();
- }
- ++recursionDepth;
- T result = parser.parsePartialFrom(this, extensionRegistry);
- checkLastTagWas(
- WireFormat.makeTag(fieldNumber, WireFormat.WIRETYPE_END_GROUP));
- --recursionDepth;
- return result;
- }
-
- /**
- * Reads a {@code group} field value from the stream and merges it into the
- * given {@link UnknownFieldSet}.
- *
- * @deprecated UnknownFieldSet.Builder now implements MessageLite.Builder, so
- * you can just call {@link #readGroup}.
- */
- @Deprecated
- public void readUnknownGroup(final int fieldNumber,
- final MessageLite.Builder builder)
- throws IOException {
- // We know that UnknownFieldSet will ignore any ExtensionRegistry so it
- // is safe to pass null here. (We can't call
- // ExtensionRegistry.getEmptyRegistry() because that would make this
- // class depend on ExtensionRegistry, which is not part of the lite
- // library.)
- readGroup(fieldNumber, builder, null);
- }
-
- /** Read an embedded message field value from the stream. */
- public void readMessage(final MessageLite.Builder builder,
- final ExtensionRegistryLite extensionRegistry)
- throws IOException {
- final int length = readRawVarint32();
- if (recursionDepth >= recursionLimit) {
- throw InvalidProtocolBufferException.recursionLimitExceeded();
- }
- final int oldLimit = pushLimit(length);
- ++recursionDepth;
- builder.mergeFrom(this, extensionRegistry);
- checkLastTagWas(0);
- --recursionDepth;
- popLimit(oldLimit);
- }
-
- /** Read an embedded message field value from the stream. */
- public <T extends MessageLite> T readMessage(
- final Parser<T> parser,
- final ExtensionRegistryLite extensionRegistry)
- throws IOException {
- int length = readRawVarint32();
- if (recursionDepth >= recursionLimit) {
- throw InvalidProtocolBufferException.recursionLimitExceeded();
- }
- final int oldLimit = pushLimit(length);
- ++recursionDepth;
- T result = parser.parsePartialFrom(this, extensionRegistry);
- checkLastTagWas(0);
- --recursionDepth;
- popLimit(oldLimit);
- return result;
- }
-
- /** Read a {@code bytes} field value from the stream. */
- public ByteString readBytes() throws IOException {
- final int size = readRawVarint32();
- if (size == 0) {
- return ByteString.EMPTY;
- } else if (size <= (bufferSize - bufferPos) && size > 0) {
- // Fast path: We already have the bytes in a contiguous buffer, so
- // just copy directly from it.
- final ByteString result = ByteString.copyFrom(buffer, bufferPos, size);
- bufferPos += size;
- return result;
- } else {
- // Slow path: Build a byte array first then copy it.
- return ByteString.copyFrom(readRawBytes(size));
- }
- }
-
- /** Read a {@code uint32} field value from the stream. */
- public int readUInt32() throws IOException {
- return readRawVarint32();
- }
-
- /**
- * Read an enum field value from the stream. Caller is responsible
- * for converting the numeric value to an actual enum.
- */
- public int readEnum() throws IOException {
- return readRawVarint32();
- }
-
- /** Read an {@code sfixed32} field value from the stream. */
- public int readSFixed32() throws IOException {
- return readRawLittleEndian32();
- }
-
- /** Read an {@code sfixed64} field value from the stream. */
- public long readSFixed64() throws IOException {
- return readRawLittleEndian64();
- }
-
- /** Read an {@code sint32} field value from the stream. */
- public int readSInt32() throws IOException {
- return decodeZigZag32(readRawVarint32());
- }
-
- /** Read an {@code sint64} field value from the stream. */
- public long readSInt64() throws IOException {
- return decodeZigZag64(readRawVarint64());
- }
-
- // =================================================================
-
- /**
- * Read a raw Varint from the stream. If larger than 32 bits, discard the
- * upper bits.
- */
- public int readRawVarint32() throws IOException {
- byte tmp = readRawByte();
- if (tmp >= 0) {
- return tmp;
- }
- int result = tmp & 0x7f;
- if ((tmp = readRawByte()) >= 0) {
- result |= tmp << 7;
- } else {
- result |= (tmp & 0x7f) << 7;
- if ((tmp = readRawByte()) >= 0) {
- result |= tmp << 14;
- } else {
- result |= (tmp & 0x7f) << 14;
- if ((tmp = readRawByte()) >= 0) {
- result |= tmp << 21;
- } else {
- result |= (tmp & 0x7f) << 21;
- result |= (tmp = readRawByte()) << 28;
- if (tmp < 0) {
- // Discard upper 32 bits.
- for (int i = 0; i < 5; i++) {
- if (readRawByte() >= 0) {
- return result;
- }
- }
- throw InvalidProtocolBufferException.malformedVarint();
- }
- }
- }
- }
- return result;
- }
-
- /**
- * Reads a varint from the input one byte at a time, so that it does not
- * read any bytes after the end of the varint. If you simply wrapped the
- * stream in a CodedInputStream and used {@link #readRawVarint32(InputStream)}
- * then you would probably end up reading past the end of the varint since
- * CodedInputStream buffers its input.
- */
- static int readRawVarint32(final InputStream input) throws IOException {
- final int firstByte = input.read();
- if (firstByte == -1) {
- throw InvalidProtocolBufferException.truncatedMessage();
- }
- return readRawVarint32(firstByte, input);
- }
-
- /**
- * Like {@link #readRawVarint32(InputStream)}, but expects that the caller
- * has already read one byte. This allows the caller to determine if EOF
- * has been reached before attempting to read.
- */
- public static int readRawVarint32(
- final int firstByte, final InputStream input) throws IOException {
- if ((firstByte & 0x80) == 0) {
- return firstByte;
- }
-
- int result = firstByte & 0x7f;
- int offset = 7;
- for (; offset < 32; offset += 7) {
- final int b = input.read();
- if (b == -1) {
- throw InvalidProtocolBufferException.truncatedMessage();
- }
- result |= (b & 0x7f) << offset;
- if ((b & 0x80) == 0) {
- return result;
- }
- }
- // Keep reading up to 64 bits.
- for (; offset < 64; offset += 7) {
- final int b = input.read();
- if (b == -1) {
- throw InvalidProtocolBufferException.truncatedMessage();
- }
- if ((b & 0x80) == 0) {
- return result;
- }
- }
- throw InvalidProtocolBufferException.malformedVarint();
- }
-
- /** Read a raw Varint from the stream. */
- public long readRawVarint64() throws IOException {
- int shift = 0;
- long result = 0;
- while (shift < 64) {
- final byte b = readRawByte();
- result |= (long)(b & 0x7F) << shift;
- if ((b & 0x80) == 0) {
- return result;
- }
- shift += 7;
- }
- throw InvalidProtocolBufferException.malformedVarint();
- }
-
- /** Read a 32-bit little-endian integer from the stream. */
- public int readRawLittleEndian32() throws IOException {
- final byte b1 = readRawByte();
- final byte b2 = readRawByte();
- final byte b3 = readRawByte();
- final byte b4 = readRawByte();
- return (((int)b1 & 0xff) ) |
- (((int)b2 & 0xff) << 8) |
- (((int)b3 & 0xff) << 16) |
- (((int)b4 & 0xff) << 24);
- }
-
- /** Read a 64-bit little-endian integer from the stream. */
- public long readRawLittleEndian64() throws IOException {
- final byte b1 = readRawByte();
- final byte b2 = readRawByte();
- final byte b3 = readRawByte();
- final byte b4 = readRawByte();
- final byte b5 = readRawByte();
- final byte b6 = readRawByte();
- final byte b7 = readRawByte();
- final byte b8 = readRawByte();
- return (((long)b1 & 0xff) ) |
- (((long)b2 & 0xff) << 8) |
- (((long)b3 & 0xff) << 16) |
- (((long)b4 & 0xff) << 24) |
- (((long)b5 & 0xff) << 32) |
- (((long)b6 & 0xff) << 40) |
- (((long)b7 & 0xff) << 48) |
- (((long)b8 & 0xff) << 56);
- }
-
- /**
- * Decode a ZigZag-encoded 32-bit value. ZigZag encodes signed integers
- * into values that can be efficiently encoded with varint. (Otherwise,
- * negative values must be sign-extended to 64 bits to be varint encoded,
- * thus always taking 10 bytes on the wire.)
- *
- * @param n An unsigned 32-bit integer, stored in a signed int because
- * Java has no explicit unsigned support.
- * @return A signed 32-bit integer.
- */
- public static int decodeZigZag32(final int n) {
- return (n >>> 1) ^ -(n & 1);
- }
-
- /**
- * Decode a ZigZag-encoded 64-bit value. ZigZag encodes signed integers
- * into values that can be efficiently encoded with varint. (Otherwise,
- * negative values must be sign-extended to 64 bits to be varint encoded,
- * thus always taking 10 bytes on the wire.)
- *
- * @param n An unsigned 64-bit integer, stored in a signed int because
- * Java has no explicit unsigned support.
- * @return A signed 64-bit integer.
- */
- public static long decodeZigZag64(final long n) {
- return (n >>> 1) ^ -(n & 1);
- }
-
- // -----------------------------------------------------------------
-
- private final byte[] buffer;
- private int bufferSize;
- private int bufferSizeAfterLimit;
- private int bufferPos;
- private final InputStream input;
- private int lastTag;
-
- /**
- * The total number of bytes read before the current buffer. The total
- * bytes read up to the current position can be computed as
- * {@code totalBytesRetired + bufferPos}. This value may be negative if
- * reading started in the middle of the current buffer (e.g. if the
- * constructor that takes a byte array and an offset was used).
- */
- private int totalBytesRetired;
-
- /** The absolute position of the end of the current message. */
- private int currentLimit = Integer.MAX_VALUE;
-
- /** See setRecursionLimit() */
- private int recursionDepth;
- private int recursionLimit = DEFAULT_RECURSION_LIMIT;
-
- /** See setSizeLimit() */
- private int sizeLimit = DEFAULT_SIZE_LIMIT;
-
- private static final int DEFAULT_RECURSION_LIMIT = 64;
- private static final int DEFAULT_SIZE_LIMIT = 64 << 20; // 64MB
- private static final int BUFFER_SIZE = 4096;
-
- private CodedInputStream(final byte[] buffer, final int off, final int len) {
- this.buffer = buffer;
- bufferSize = off + len;
- bufferPos = off;
- totalBytesRetired = -off;
- input = null;
- }
-
- private CodedInputStream(final InputStream input) {
- buffer = new byte[BUFFER_SIZE];
- bufferSize = 0;
- bufferPos = 0;
- totalBytesRetired = 0;
- this.input = input;
- }
-
- /**
- * Set the maximum message recursion depth. In order to prevent malicious
- * messages from causing stack overflows, {@code CodedInputStream} limits
- * how deeply messages may be nested. The default limit is 64.
- *
- * @return the old limit.
- */
- public int setRecursionLimit(final int limit) {
- if (limit < 0) {
- throw new IllegalArgumentException(
- "Recursion limit cannot be negative: " + limit);
- }
- final int oldLimit = recursionLimit;
- recursionLimit = limit;
- return oldLimit;
- }
-
- /**
- * Set the maximum message size. In order to prevent malicious
- * messages from exhausting memory or causing integer overflows,
- * {@code CodedInputStream} limits how large a message may be.
- * The default limit is 64MB. You should set this limit as small
- * as you can without harming your app's functionality. Note that
- * size limits only apply when reading from an {@code InputStream}, not
- * when constructed around a raw byte array (nor with
- * {@link ByteString#newCodedInput}).
- * <p>
- * If you want to read several messages from a single CodedInputStream, you
- * could call {@link #resetSizeCounter()} after each one to avoid hitting the
- * size limit.
- *
- * @return the old limit.
- */
- public int setSizeLimit(final int limit) {
- if (limit < 0) {
- throw new IllegalArgumentException(
- "Size limit cannot be negative: " + limit);
- }
- final int oldLimit = sizeLimit;
- sizeLimit = limit;
- return oldLimit;
- }
-
- /**
- * Resets the current size counter to zero (see {@link #setSizeLimit(int)}).
- */
- public void resetSizeCounter() {
- totalBytesRetired = -bufferPos;
- }
-
- /**
- * Sets {@code currentLimit} to (current position) + {@code byteLimit}. This
- * is called when descending into a length-delimited embedded message.
- *
- * <p>Note that {@code pushLimit()} does NOT affect how many bytes the
- * {@code CodedInputStream} reads from an underlying {@code InputStream} when
- * refreshing its buffer. If you need to prevent reading past a certain
- * point in the underlying {@code InputStream} (e.g. because you expect it to
- * contain more data after the end of the message which you need to handle
- * differently) then you must place a wrapper around your {@code InputStream}
- * which limits the amount of data that can be read from it.
- *
- * @return the old limit.
- */
- public int pushLimit(int byteLimit) throws InvalidProtocolBufferException {
- if (byteLimit < 0) {
- throw InvalidProtocolBufferException.negativeSize();
- }
- byteLimit += totalBytesRetired + bufferPos;
- final int oldLimit = currentLimit;
- if (byteLimit > oldLimit) {
- throw InvalidProtocolBufferException.truncatedMessage();
- }
- currentLimit = byteLimit;
-
- recomputeBufferSizeAfterLimit();
-
- return oldLimit;
- }
-
- private void recomputeBufferSizeAfterLimit() {
- bufferSize += bufferSizeAfterLimit;
- final int bufferEnd = totalBytesRetired + bufferSize;
- if (bufferEnd > currentLimit) {
- // Limit is in current buffer.
- bufferSizeAfterLimit = bufferEnd - currentLimit;
- bufferSize -= bufferSizeAfterLimit;
- } else {
- bufferSizeAfterLimit = 0;
- }
- }
-
- /**
- * Discards the current limit, returning to the previous limit.
- *
- * @param oldLimit The old limit, as returned by {@code pushLimit}.
- */
- public void popLimit(final int oldLimit) {
- currentLimit = oldLimit;
- recomputeBufferSizeAfterLimit();
- }
-
- /**
- * Returns the number of bytes to be read before the current limit.
- * If no limit is set, returns -1.
- */
- public int getBytesUntilLimit() {
- if (currentLimit == Integer.MAX_VALUE) {
- return -1;
- }
-
- final int currentAbsolutePosition = totalBytesRetired + bufferPos;
- return currentLimit - currentAbsolutePosition;
- }
-
- /**
- * Returns true if the stream has reached the end of the input. This is the
- * case if either the end of the underlying input source has been reached or
- * if the stream has reached a limit created using {@link #pushLimit(int)}.
- */
- public boolean isAtEnd() throws IOException {
- return bufferPos == bufferSize && !refillBuffer(false);
- }
-
- /**
- * The total bytes read up to the current position. Calling
- * {@link #resetSizeCounter()} resets this value to zero.
- */
- public int getTotalBytesRead() {
- return totalBytesRetired + bufferPos;
- }
-
- /**
- * Called with {@code this.buffer} is empty to read more bytes from the
- * input. If {@code mustSucceed} is true, refillBuffer() guarantees that
- * either there will be at least one byte in the buffer when it returns
- * or it will throw an exception. If {@code mustSucceed} is false,
- * refillBuffer() returns false if no more bytes were available.
- */
- private boolean refillBuffer(final boolean mustSucceed) throws IOException {
- if (bufferPos < bufferSize) {
- throw new IllegalStateException(
- "refillBuffer() called when buffer wasn't empty.");
- }
-
- if (totalBytesRetired + bufferSize == currentLimit) {
- // Oops, we hit a limit.
- if (mustSucceed) {
- throw InvalidProtocolBufferException.truncatedMessage();
- } else {
- return false;
- }
- }
-
- totalBytesRetired += bufferSize;
-
- bufferPos = 0;
- bufferSize = (input == null) ? -1 : input.read(buffer);
- if (bufferSize == 0 || bufferSize < -1) {
- throw new IllegalStateException(
- "InputStream#read(byte[]) returned invalid result: " + bufferSize +
- "\nThe InputStream implementation is buggy.");
- }
- if (bufferSize == -1) {
- bufferSize = 0;
- if (mustSucceed) {
- throw InvalidProtocolBufferException.truncatedMessage();
- } else {
- return false;
- }
- } else {
- recomputeBufferSizeAfterLimit();
- final int totalBytesRead =
- totalBytesRetired + bufferSize + bufferSizeAfterLimit;
- if (totalBytesRead > sizeLimit || totalBytesRead < 0) {
- throw InvalidProtocolBufferException.sizeLimitExceeded();
- }
- return true;
- }
- }
-
- /**
- * Read one byte from the input.
- *
- * @throws InvalidProtocolBufferException The end of the stream or the current
- * limit was reached.
- */
- public byte readRawByte() throws IOException {
- if (bufferPos == bufferSize) {
- refillBuffer(true);
- }
- return buffer[bufferPos++];
- }
-
- /**
- * Read a fixed size of bytes from the input.
- *
- * @throws InvalidProtocolBufferException The end of the stream or the current
- * limit was reached.
- */
- public byte[] readRawBytes(final int size) throws IOException {
- if (size < 0) {
- throw InvalidProtocolBufferException.negativeSize();
- }
-
- if (totalBytesRetired + bufferPos + size > currentLimit) {
- // Read to the end of the stream anyway.
- skipRawBytes(currentLimit - totalBytesRetired - bufferPos);
- // Then fail.
- throw InvalidProtocolBufferException.truncatedMessage();
- }
-
- if (size <= bufferSize - bufferPos) {
- // We have all the bytes we need already.
- final byte[] bytes = new byte[size];
- System.arraycopy(buffer, bufferPos, bytes, 0, size);
- bufferPos += size;
- return bytes;
- } else if (size < BUFFER_SIZE) {
- // Reading more bytes than are in the buffer, but not an excessive number
- // of bytes. We can safely allocate the resulting array ahead of time.
-
- // First copy what we have.
- final byte[] bytes = new byte[size];
- int pos = bufferSize - bufferPos;
- System.arraycopy(buffer, bufferPos, bytes, 0, pos);
- bufferPos = bufferSize;
-
- // We want to use refillBuffer() and then copy from the buffer into our
- // byte array rather than reading directly into our byte array because
- // the input may be unbuffered.
- refillBuffer(true);
-
- while (size - pos > bufferSize) {
- System.arraycopy(buffer, 0, bytes, pos, bufferSize);
- pos += bufferSize;
- bufferPos = bufferSize;
- refillBuffer(true);
- }
-
- System.arraycopy(buffer, 0, bytes, pos, size - pos);
- bufferPos = size - pos;
-
- return bytes;
- } else {
- // The size is very large. For security reasons, we can't allocate the
- // entire byte array yet. The size comes directly from the input, so a
- // maliciously-crafted message could provide a bogus very large size in
- // order to trick the app into allocating a lot of memory. We avoid this
- // by allocating and reading only a small chunk at a time, so that the
- // malicious message must actually *be* extremely large to cause
- // problems. Meanwhile, we limit the allowed size of a message elsewhere.
-
- // Remember the buffer markers since we'll have to copy the bytes out of
- // it later.
- final int originalBufferPos = bufferPos;
- final int originalBufferSize = bufferSize;
-
- // Mark the current buffer consumed.
- totalBytesRetired += bufferSize;
- bufferPos = 0;
- bufferSize = 0;
-
- // Read all the rest of the bytes we need.
- int sizeLeft = size - (originalBufferSize - originalBufferPos);
- final List<byte[]> chunks = new ArrayList<byte[]>();
-
- while (sizeLeft > 0) {
- final byte[] chunk = new byte[Math.min(sizeLeft, BUFFER_SIZE)];
- int pos = 0;
- while (pos < chunk.length) {
- final int n = (input == null) ? -1 :
- input.read(chunk, pos, chunk.length - pos);
- if (n == -1) {
- throw InvalidProtocolBufferException.truncatedMessage();
- }
- totalBytesRetired += n;
- pos += n;
- }
- sizeLeft -= chunk.length;
- chunks.add(chunk);
- }
-
- // OK, got everything. Now concatenate it all into one buffer.
- final byte[] bytes = new byte[size];
-
- // Start by copying the leftover bytes from this.buffer.
- int pos = originalBufferSize - originalBufferPos;
- System.arraycopy(buffer, originalBufferPos, bytes, 0, pos);
-
- // And now all the chunks.
- for (final byte[] chunk : chunks) {
- System.arraycopy(chunk, 0, bytes, pos, chunk.length);
- pos += chunk.length;
- }
-
- // Done.
- return bytes;
- }
- }
-
- /**
- * Reads and discards {@code size} bytes.
- *
- * @throws InvalidProtocolBufferException The end of the stream or the current
- * limit was reached.
- */
- public void skipRawBytes(final int size) throws IOException {
- if (size < 0) {
- throw InvalidProtocolBufferException.negativeSize();
- }
-
- if (totalBytesRetired + bufferPos + size > currentLimit) {
- // Read to the end of the stream anyway.
- skipRawBytes(currentLimit - totalBytesRetired - bufferPos);
- // Then fail.
- throw InvalidProtocolBufferException.truncatedMessage();
- }
-
- if (size <= bufferSize - bufferPos) {
- // We have all the bytes we need already.
- bufferPos += size;
- } else {
- // Skipping more bytes than are in the buffer. First skip what we have.
- int pos = bufferSize - bufferPos;
- bufferPos = bufferSize;
-
- // Keep refilling the buffer until we get to the point we wanted to skip
- // to. This has the side effect of ensuring the limits are updated
- // correctly.
- refillBuffer(true);
- while (size - pos > bufferSize) {
- pos += bufferSize;
- bufferPos = bufferSize;
- refillBuffer(true);
- }
-
- bufferPos = size - pos;
- }
- }
-}
diff --git a/protobuf/src/main/java/org/apache/pekko/protobuf/CodedOutputStream.java b/protobuf/src/main/java/org/apache/pekko/protobuf/CodedOutputStream.java
deleted file mode 100644
index f294ae57aa..0000000000
--- a/protobuf/src/main/java/org/apache/pekko/protobuf/CodedOutputStream.java
+++ /dev/null
@@ -1,1119 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * license agreements; and to You under the Apache License, version 2.0:
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * This file is part of the Apache Pekko project, which was derived from Akka.
- */
-
-/*
- * Copyright (C) 2018-2022 Lightbend Inc. <https://www.lightbend.com>
- */
-
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package org.apache.pekko.protobuf;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.nio.charset.StandardCharsets;
-
-/**
- * Encodes and writes protocol message fields.
- *
- * <p>This class contains two kinds of methods: methods that write specific
- * protocol message constructs and field types (e.g. {@link #writeTag} and
- * {@link #writeInt32}) and methods that write low-level values (e.g.
- * {@link #writeRawVarint32} and {@link #writeRawBytes}). If you are
- * writing encoded protocol messages, you should use the former methods, but if
- * you are writing some other format of your own design, use the latter.
- *
- * <p>This class is totally unsynchronized.
- *
- * @author kneton@google.com Kenton Varda
- */
-public final class CodedOutputStream {
- private final byte[] buffer;
- private final int limit;
- private int position;
-
- private final OutputStream output;
-
- /**
- * The buffer size used in {@link #newInstance(OutputStream)}.
- */
- public static final int DEFAULT_BUFFER_SIZE = 4096;
-
- /**
- * Returns the buffer size to efficiently write dataLength bytes to this
- * CodedOutputStream. Used by AbstractMessageLite.
- *
- * @return the buffer size to efficiently write dataLength bytes to this
- * CodedOutputStream.
- */
- static int computePreferredBufferSize(int dataLength) {
- return Math.min(dataLength, DEFAULT_BUFFER_SIZE);
- }
-
- private CodedOutputStream(final byte[] buffer, final int offset,
- final int length) {
- output = null;
- this.buffer = buffer;
- position = offset;
- limit = offset + length;
- }
-
- private CodedOutputStream(final OutputStream output, final byte[] buffer) {
- this.output = output;
- this.buffer = buffer;
- position = 0;
- limit = buffer.length;
- }
-
- /**
- * Create a new {@code CodedOutputStream} wrapping the given
- * {@code OutputStream}.
- */
- public static CodedOutputStream newInstance(final OutputStream output) {
- return newInstance(output, DEFAULT_BUFFER_SIZE);
- }
-
- /**
- * Create a new {@code CodedOutputStream} wrapping the given
- * {@code OutputStream} with a given buffer size.
- */
- public static CodedOutputStream newInstance(final OutputStream output,
- final int bufferSize) {
- return new CodedOutputStream(output, new byte[bufferSize]);
- }
-
- /**
- * Create a new {@code CodedOutputStream} that writes directly to the given
- * byte array. If more bytes are written than fit in the array,
- * {@link OutOfSpaceException} will be thrown. Writing directly to a flat
- * array is faster than writing to an {@code OutputStream}. See also
- * {@link ByteString#newCodedBuilder}.
- */
- public static CodedOutputStream newInstance(final byte[] flatArray) {
- return newInstance(flatArray, 0, flatArray.length);
- }
-
- /**
- * Create a new {@code CodedOutputStream} that writes directly to the given
- * byte array slice. If more bytes are written than fit in the slice,
- * {@link OutOfSpaceException} will be thrown. Writing directly to a flat
- * array is faster than writing to an {@code OutputStream}. See also
- * {@link ByteString#newCodedBuilder}.
- */
- public static CodedOutputStream newInstance(final byte[] flatArray,
- final int offset,
- final int length) {
- return new CodedOutputStream(flatArray, offset, length);
- }
-
- // -----------------------------------------------------------------
-
- /** Write a {@code double} field, including tag, to the stream. */
- public void writeDouble(final int fieldNumber, final double value)
- throws IOException {
- writeTag(fieldNumber, WireFormat.WIRETYPE_FIXED64);
- writeDoubleNoTag(value);
- }
-
- /** Write a {@code float} field, including tag, to the stream. */
- public void writeFloat(final int fieldNumber, final float value)
- throws IOException {
- writeTag(fieldNumber, WireFormat.WIRETYPE_FIXED32);
- writeFloatNoTag(value);
- }
-
- /** Write a {@code uint64} field, including tag, to the stream. */
- public void writeUInt64(final int fieldNumber, final long value)
- throws IOException {
- writeTag(fieldNumber, WireFormat.WIRETYPE_VARINT);
- writeUInt64NoTag(value);
- }
-
- /** Write an {@code int64} field, including tag, to the stream. */
- public void writeInt64(final int fieldNumber, final long value)
- throws IOException {
- writeTag(fieldNumber, WireFormat.WIRETYPE_VARINT);
- writeInt64NoTag(value);
- }
-
- /** Write an {@code int32} field, including tag, to the stream. */
- public void writeInt32(final int fieldNumber, final int value)
- throws IOException {
- writeTag(fieldNumber, WireFormat.WIRETYPE_VARINT);
- writeInt32NoTag(value);
- }
-
- /** Write a {@code fixed64} field, including tag, to the stream. */
- public void writeFixed64(final int fieldNumber, final long value)
- throws IOException {
- writeTag(fieldNumber, WireFormat.WIRETYPE_FIXED64);
- writeFixed64NoTag(value);
- }
-
- /** Write a {@code fixed32} field, including tag, to the stream. */
- public void writeFixed32(final int fieldNumber, final int value)
- throws IOException {
- writeTag(fieldNumber, WireFormat.WIRETYPE_FIXED32);
- writeFixed32NoTag(value);
- }
-
- /** Write a {@code bool} field, including tag, to the stream. */
- public void writeBool(final int fieldNumber, final boolean value)
- throws IOException {
- writeTag(fieldNumber, WireFormat.WIRETYPE_VARINT);
- writeBoolNoTag(value);
- }
-
- /** Write a {@code string} field, including tag, to the stream. */
- public void writeString(final int fieldNumber, final String value)
- throws IOException {
- writeTag(fieldNumber, WireFormat.WIRETYPE_LENGTH_DELIMITED);
- writeStringNoTag(value);
- }
-
- /** Write a {@code group} field, including tag, to the stream. */
- public void writeGroup(final int fieldNumber, final MessageLite value)
- throws IOException {
- writeTag(fieldNumber, WireFormat.WIRETYPE_START_GROUP);
- writeGroupNoTag(value);
- writeTag(fieldNumber, WireFormat.WIRETYPE_END_GROUP);
- }
-
- /**
- * Write a group represented by an {@link UnknownFieldSet}.
- *
- * @deprecated UnknownFieldSet now implements MessageLite, so you can just
- * call {@link #writeGroup}.
- */
- @Deprecated
- public void writeUnknownGroup(final int fieldNumber,
- final MessageLite value)
- throws IOException {
- writeGroup(fieldNumber, value);
- }
-
- /** Write an embedded message field, including tag, to the stream. */
- public void writeMessage(final int fieldNumber, final MessageLite value)
- throws IOException {
- writeTag(fieldNumber, WireFormat.WIRETYPE_LENGTH_DELIMITED);
- writeMessageNoTag(value);
- }
-
- /** Write a {@code bytes} field, including tag, to the stream. */
- public void writeBytes(final int fieldNumber, final ByteString value)
- throws IOException {
- writeTag(fieldNumber, WireFormat.WIRETYPE_LENGTH_DELIMITED);
- writeBytesNoTag(value);
- }
-
- /** Write a {@code uint32} field, including tag, to the stream. */
- public void writeUInt32(final int fieldNumber, final int value)
- throws IOException {
- writeTag(fieldNumber, WireFormat.WIRETYPE_VARINT);
- writeUInt32NoTag(value);
- }
-
- /**
- * Write an enum field, including tag, to the stream. Caller is responsible
- * for converting the enum value to its numeric value.
- */
- public void writeEnum(final int fieldNumber, final int value)
- throws IOException {
- writeTag(fieldNumber, WireFormat.WIRETYPE_VARINT);
- writeEnumNoTag(value);
- }
-
- /** Write an {@code sfixed32} field, including tag, to the stream. */
- public void writeSFixed32(final int fieldNumber, final int value)
- throws IOException {
- writeTag(fieldNumber, WireFormat.WIRETYPE_FIXED32);
- writeSFixed32NoTag(value);
- }
-
- /** Write an {@code sfixed64} field, including tag, to the stream. */
- public void writeSFixed64(final int fieldNumber, final long value)
- throws IOException {
- writeTag(fieldNumber, WireFormat.WIRETYPE_FIXED64);
- writeSFixed64NoTag(value);
- }
-
- /** Write an {@code sint32} field, including tag, to the stream. */
- public void writeSInt32(final int fieldNumber, final int value)
- throws IOException {
- writeTag(fieldNumber, WireFormat.WIRETYPE_VARINT);
- writeSInt32NoTag(value);
- }
-
- /** Write an {@code sint64} field, including tag, to the stream. */
- public void writeSInt64(final int fieldNumber, final long value)
- throws IOException {
- writeTag(fieldNumber, WireFormat.WIRETYPE_VARINT);
- writeSInt64NoTag(value);
- }
-
- /**
- * Write a MessageSet extension field to the stream. For historical reasons,
- * the wire format differs from normal fields.
- */
- public void writeMessageSetExtension(final int fieldNumber,
- final MessageLite value)
- throws IOException {
- writeTag(WireFormat.MESSAGE_SET_ITEM, WireFormat.WIRETYPE_START_GROUP);
- writeUInt32(WireFormat.MESSAGE_SET_TYPE_ID, fieldNumber);
- writeMessage(WireFormat.MESSAGE_SET_MESSAGE, value);
- writeTag(WireFormat.MESSAGE_SET_ITEM, WireFormat.WIRETYPE_END_GROUP);
- }
-
- /**
- * Write an unparsed MessageSet extension field to the stream. For
- * historical reasons, the wire format differs from normal fields.
- */
- public void writeRawMessageSetExtension(final int fieldNumber,
- final ByteString value)
- throws IOException {
- writeTag(WireFormat.MESSAGE_SET_ITEM, WireFormat.WIRETYPE_START_GROUP);
- writeUInt32(WireFormat.MESSAGE_SET_TYPE_ID, fieldNumber);
- writeBytes(WireFormat.MESSAGE_SET_MESSAGE, value);
- writeTag(WireFormat.MESSAGE_SET_ITEM, WireFormat.WIRETYPE_END_GROUP);
- }
-
- // -----------------------------------------------------------------
-
- /** Write a {@code double} field to the stream. */
- public void writeDoubleNoTag(final double value) throws IOException {
- writeRawLittleEndian64(Double.doubleToRawLongBits(value));
- }
-
- /** Write a {@code float} field to the stream. */
- public void writeFloatNoTag(final float value) throws IOException {
- writeRawLittleEndian32(Float.floatToRawIntBits(value));
- }
-
- /** Write a {@code uint64} field to the stream. */
- public void writeUInt64NoTag(final long value) throws IOException {
- writeRawVarint64(value);
- }
-
- /** Write an {@code int64} field to the stream. */
- public void writeInt64NoTag(final long value) throws IOException {
- writeRawVarint64(value);
- }
-
- /** Write an {@code int32} field to the stream. */
- public void writeInt32NoTag(final int value) throws IOException {
- if (value >= 0) {
- writeRawVarint32(value);
- } else {
- // Must sign-extend.
- writeRawVarint64(value);
- }
- }
-
- /** Write a {@code fixed64} field to the stream. */
- public void writeFixed64NoTag(final long value) throws IOException {
- writeRawLittleEndian64(value);
- }
-
- /** Write a {@code fixed32} field to the stream. */
- public void writeFixed32NoTag(final int value) throws IOException {
- writeRawLittleEndian32(value);
- }
-
- /** Write a {@code bool} field to the stream. */
- public void writeBoolNoTag(final boolean value) throws IOException {
- writeRawByte(value ? 1 : 0);
- }
-
- /** Write a {@code string} field to the stream. */
- public void writeStringNoTag(final String value) throws IOException {
- // Unfortunately there does not appear to be any way to tell Java to encode
- // UTF-8 directly into our buffer, so we have to let it create its own byte
- // array and then copy.
- final byte[] bytes = value.getBytes(StandardCharsets.UTF_8);
- writeRawVarint32(bytes.length);
- writeRawBytes(bytes);
- }
-
- /** Write a {@code group} field to the stream. */
- public void writeGroupNoTag(final MessageLite value) throws IOException {
- value.writeTo(this);
- }
-
- /**
- * Write a group represented by an {@link UnknownFieldSet}.
- *
- * @deprecated UnknownFieldSet now implements MessageLite, so you can just
- * call {@link #writeGroupNoTag}.
- */
- @Deprecated
- public void writeUnknownGroupNoTag(final MessageLite value)
- throws IOException {
- writeGroupNoTag(value);
- }
-
- /** Write an embedded message field to the stream. */
- public void writeMessageNoTag(final MessageLite value) throws IOException {
- writeRawVarint32(value.getSerializedSize());
- value.writeTo(this);
- }
-
- /** Write a {@code bytes} field to the stream. */
- public void writeBytesNoTag(final ByteString value) throws IOException {
- writeRawVarint32(value.size());
- writeRawBytes(value);
- }
-
- /** Write a {@code uint32} field to the stream. */
- public void writeUInt32NoTag(final int value) throws IOException {
- writeRawVarint32(value);
- }
-
- /**
- * Write an enum field to the stream. Caller is responsible
- * for converting the enum value to its numeric value.
- */
- public void writeEnumNoTag(final int value) throws IOException {
- writeInt32NoTag(value);
- }
-
- /** Write an {@code sfixed32} field to the stream. */
- public void writeSFixed32NoTag(final int value) throws IOException {
- writeRawLittleEndian32(value);
- }
-
- /** Write an {@code sfixed64} field to the stream. */
- public void writeSFixed64NoTag(final long value) throws IOException {
- writeRawLittleEndian64(value);
- }
-
- /** Write an {@code sint32} field to the stream. */
- public void writeSInt32NoTag(final int value) throws IOException {
- writeRawVarint32(encodeZigZag32(value));
- }
-
- /** Write an {@code sint64} field to the stream. */
- public void writeSInt64NoTag(final long value) throws IOException {
- writeRawVarint64(encodeZigZag64(value));
- }
-
- // =================================================================
-
- /**
- * Compute the number of bytes that would be needed to encode a
- * {@code double} field, including tag.
- */
- public static int computeDoubleSize(final int fieldNumber,
- final double value) {
- return computeTagSize(fieldNumber) + computeDoubleSizeNoTag(value);
- }
-
- /**
- * Compute the number of bytes that would be needed to encode a
- * {@code float} field, including tag.
- */
- public static int computeFloatSize(final int fieldNumber, final float value) {
- return computeTagSize(fieldNumber) + computeFloatSizeNoTag(value);
- }
-
- /**
- * Compute the number of bytes that would be needed to encode a
- * {@code uint64} field, including tag.
- */
- public static int computeUInt64Size(final int fieldNumber, final long value) {
- return computeTagSize(fieldNumber) + computeUInt64SizeNoTag(value);
- }
-
- /**
- * Compute the number of bytes that would be needed to encode an
- * {@code int64} field, including tag.
- */
- public static int computeInt64Size(final int fieldNumber, final long value) {
- return computeTagSize(fieldNumber) + computeInt64SizeNoTag(value);
- }
-
- /**
- * Compute the number of bytes that would be needed to encode an
- * {@code int32} field, including tag.
- */
- public static int computeInt32Size(final int fieldNumber, final int value) {
- return computeTagSize(fieldNumber) + computeInt32SizeNoTag(value);
- }
-
- /**
- * Compute the number of bytes that would be needed to encode a
- * {@code fixed64} field, including tag.
- */
- public static int computeFixed64Size(final int fieldNumber,
- final long value) {
- return computeTagSize(fieldNumber) + computeFixed64SizeNoTag(value);
- }
-
- /**
- * Compute the number of bytes that would be needed to encode a
- * {@code fixed32} field, including tag.
- */
- public static int computeFixed32Size(final int fieldNumber,
- final int value) {
- return computeTagSize(fieldNumber) + computeFixed32SizeNoTag(value);
- }
-
- /**
- * Compute the number of bytes that would be needed to encode a
- * {@code bool} field, including tag.
- */
- public static int computeBoolSize(final int fieldNumber,
- final boolean value) {
- return computeTagSize(fieldNumber) + computeBoolSizeNoTag(value);
- }
-
- /**
- * Compute the number of bytes that would be needed to encode a
- * {@code string} field, including tag.
- */
- public static int computeStringSize(final int fieldNumber,
- final String value) {
- return computeTagSize(fieldNumber) + computeStringSizeNoTag(value);
- }
-
- /**
- * Compute the number of bytes that would be needed to encode a
- * {@code group} field, including tag.
- */
- public static int computeGroupSize(final int fieldNumber,
- final MessageLite value) {
- return computeTagSize(fieldNumber) * 2 + computeGroupSizeNoTag(value);
- }
-
- /**
- * Compute the number of bytes that would be needed to encode a
- * {@code group} field represented by an {@code UnknownFieldSet}, including
- * tag.
- *
- * @deprecated UnknownFieldSet now implements MessageLite, so you can just
- * call {@link #computeGroupSize}.
- */
- @Deprecated
- public static int computeUnknownGroupSize(final int fieldNumber,
- final MessageLite value) {
- return computeGroupSize(fieldNumber, value);
- }
-
- /**
- * Compute the number of bytes that would be needed to encode an
- * embedded message field, including tag.
- */
- public static int computeMessageSize(final int fieldNumber,
- final MessageLite value) {
- return computeTagSize(fieldNumber) + computeMessageSizeNoTag(value);
- }
-
- /**
- * Compute the number of bytes that would be needed to encode a
- * {@code bytes} field, including tag.
- */
- public static int computeBytesSize(final int fieldNumber,
- final ByteString value) {
- return computeTagSize(fieldNumber) + computeBytesSizeNoTag(value);
- }
-
- /**
- * Compute the number of bytes that would be needed to encode an
- * embedded message in lazy field, including tag.
- */
- public static int computeLazyFieldSize(final int fieldNumber,
- final LazyField value) {
- return computeTagSize(fieldNumber) + computeLazyFieldSizeNoTag(value);
- }
-
- /**
- * Compute the number of bytes that would be needed to encode a
- * {@code uint32} field, including tag.
- */
- public static int computeUInt32Size(final int fieldNumber, final int value) {
- return computeTagSize(fieldNumber) + computeUInt32SizeNoTag(value);
- }
-
- /**
- * Compute the number of bytes that would be needed to encode an
- * enum field, including tag. Caller is responsible for converting the
- * enum value to its numeric value.
- */
- public static int computeEnumSize(final int fieldNumber, final int value) {
- return computeTagSize(fieldNumber) + computeEnumSizeNoTag(value);
- }
-
- /**
- * Compute the number of bytes that would be needed to encode an
- * {@code sfixed32} field, including tag.
- */
- public static int computeSFixed32Size(final int fieldNumber,
- final int value) {
- return computeTagSize(fieldNumber) + computeSFixed32SizeNoTag(value);
- }
-
- /**
- * Compute the number of bytes that would be needed to encode an
- * {@code sfixed64} field, including tag.
- */
- public static int computeSFixed64Size(final int fieldNumber,
- final long value) {
- return computeTagSize(fieldNumber) + computeSFixed64SizeNoTag(value);
- }
-
- /**
- * Compute the number of bytes that would be needed to encode an
- * {@code sint32} field, including tag.
- */
- public static int computeSInt32Size(final int fieldNumber, final int value) {
- return computeTagSize(fieldNumber) + computeSInt32SizeNoTag(value);
- }
-
- /**
- * Compute the number of bytes that would be needed to encode an
- * {@code sint64} field, including tag.
- */
- public static int computeSInt64Size(final int fieldNumber, final long value) {
- return computeTagSize(fieldNumber) + computeSInt64SizeNoTag(value);
- }
-
- /**
- * Compute the number of bytes that would be needed to encode a
- * MessageSet extension to the stream. For historical reasons,
- * the wire format differs from normal fields.
- */
- public static int computeMessageSetExtensionSize(
- final int fieldNumber, final MessageLite value) {
- return computeTagSize(WireFormat.MESSAGE_SET_ITEM) * 2 +
- computeUInt32Size(WireFormat.MESSAGE_SET_TYPE_ID, fieldNumber) +
- computeMessageSize(WireFormat.MESSAGE_SET_MESSAGE, value);
- }
-
- /**
- * Compute the number of bytes that would be needed to encode an
- * unparsed MessageSet extension field to the stream. For
- * historical reasons, the wire format differs from normal fields.
- */
- public static int computeRawMessageSetExtensionSize(
- final int fieldNumber, final ByteString value) {
- return computeTagSize(WireFormat.MESSAGE_SET_ITEM) * 2 +
- computeUInt32Size(WireFormat.MESSAGE_SET_TYPE_ID, fieldNumber) +
- computeBytesSize(WireFormat.MESSAGE_SET_MESSAGE, value);
- }
-
- /**
- * Compute the number of bytes that would be needed to encode an
- * lazily parsed MessageSet extension field to the stream. For
- * historical reasons, the wire format differs from normal fields.
- */
- public static int computeLazyFieldMessageSetExtensionSize(
- final int fieldNumber, final LazyField value) {
- return computeTagSize(WireFormat.MESSAGE_SET_ITEM) * 2 +
- computeUInt32Size(WireFormat.MESSAGE_SET_TYPE_ID, fieldNumber) +
- computeLazyFieldSize(WireFormat.MESSAGE_SET_MESSAGE, value);
- }
-
- // -----------------------------------------------------------------
-
- /**
- * Compute the number of bytes that would be needed to encode a
- * {@code double} field, including tag.
- */
- public static int computeDoubleSizeNoTag(final double value) {
- return LITTLE_ENDIAN_64_SIZE;
- }
-
- /**
- * Compute the number of bytes that would be needed to encode a
- * {@code float} field, including tag.
- */
- public static int computeFloatSizeNoTag(final float value) {
- return LITTLE_ENDIAN_32_SIZE;
- }
-
- /**
- * Compute the number of bytes that would be needed to encode a
- * {@code uint64} field, including tag.
- */
- public static int computeUInt64SizeNoTag(final long value) {
- return computeRawVarint64Size(value);
- }
-
- /**
- * Compute the number of bytes that would be needed to encode an
- * {@code int64} field, including tag.
- */
- public static int computeInt64SizeNoTag(final long value) {
- return computeRawVarint64Size(value);
- }
-
- /**
- * Compute the number of bytes that would be needed to encode an
- * {@code int32} field, including tag.
- */
- public static int computeInt32SizeNoTag(final int value) {
- if (value >= 0) {
- return computeRawVarint32Size(value);
- } else {
- // Must sign-extend.
- return 10;
- }
- }
-
- /**
- * Compute the number of bytes that would be needed to encode a
- * {@code fixed64} field.
- */
- public static int computeFixed64SizeNoTag(final long value) {
- return LITTLE_ENDIAN_64_SIZE;
- }
-
- /**
- * Compute the number of bytes that would be needed to encode a
- * {@code fixed32} field.
- */
- public static int computeFixed32SizeNoTag(final int value) {
- return LITTLE_ENDIAN_32_SIZE;
- }
-
- /**
- * Compute the number of bytes that would be needed to encode a
- * {@code bool} field.
- */
- public static int computeBoolSizeNoTag(final boolean value) {
- return 1;
- }
-
- /**
- * Compute the number of bytes that would be needed to encode a
- * {@code string} field.
- */
- public static int computeStringSizeNoTag(final String value) {
- final byte[] bytes = value.getBytes(StandardCharsets.UTF_8);
- return computeRawVarint32Size(bytes.length) +
- bytes.length;
- }
-
- /**
- * Compute the number of bytes that would be needed to encode a
- * {@code group} field.
- */
- public static int computeGroupSizeNoTag(final MessageLite value) {
- return value.getSerializedSize();
- }
-
- /**
- * Compute the number of bytes that would be needed to encode a
- * {@code group} field represented by an {@code UnknownFieldSet}, including
- * tag.
- *
- * @deprecated UnknownFieldSet now implements MessageLite, so you can just
- * call {@link #computeUnknownGroupSizeNoTag}.
- */
- @Deprecated
- public static int computeUnknownGroupSizeNoTag(final MessageLite value) {
- return computeGroupSizeNoTag(value);
- }
-
- /**
- * Compute the number of bytes that would be needed to encode an embedded
- * message field.
- */
- public static int computeMessageSizeNoTag(final MessageLite value) {
- final int size = value.getSerializedSize();
- return computeRawVarint32Size(size) + size;
- }
-
- /**
- * Compute the number of bytes that would be needed to encode an embedded
- * message stored in lazy field.
- */
- public static int computeLazyFieldSizeNoTag(final LazyField value) {
- final int size = value.getSerializedSize();
- return computeRawVarint32Size(size) + size;
- }
-
- /**
- * Compute the number of bytes that would be needed to encode a
- * {@code bytes} field.
- */
- public static int computeBytesSizeNoTag(final ByteString value) {
- return computeRawVarint32Size(value.size()) +
- value.size();
- }
-
- /**
- * Compute the number of bytes that would be needed to encode a
- * {@code uint32} field.
- */
- public static int computeUInt32SizeNoTag(final int value) {
- return computeRawVarint32Size(value);
- }
-
- /**
- * Compute the number of bytes that would be needed to encode an enum field.
- * Caller is responsible for converting the enum value to its numeric value.
- */
- public static int computeEnumSizeNoTag(final int value) {
- return computeInt32SizeNoTag(value);
- }
-
- /**
- * Compute the number of bytes that would be needed to encode an
- * {@code sfixed32} field.
- */
- public static int computeSFixed32SizeNoTag(final int value) {
- return LITTLE_ENDIAN_32_SIZE;
- }
-
- /**
- * Compute the number of bytes that would be needed to encode an
- * {@code sfixed64} field.
- */
- public static int computeSFixed64SizeNoTag(final long value) {
- return LITTLE_ENDIAN_64_SIZE;
- }
-
- /**
- * Compute the number of bytes that would be needed to encode an
- * {@code sint32} field.
- */
- public static int computeSInt32SizeNoTag(final int value) {
- return computeRawVarint32Size(encodeZigZag32(value));
- }
-
- /**
- * Compute the number of bytes that would be needed to encode an
- * {@code sint64} field.
- */
- public static int computeSInt64SizeNoTag(final long value) {
- return computeRawVarint64Size(encodeZigZag64(value));
- }
-
- // =================================================================
-
- /**
- * Internal helper that writes the current buffer to the output. The
- * buffer position is reset to its initial value when this returns.
- */
- private void refreshBuffer() throws IOException {
- if (output == null) {
- // We're writing to a single buffer.
- throw new OutOfSpaceException();
- }
-
- // Since we have an output stream, this is our buffer
- // and buffer offset == 0
- output.write(buffer, 0, position);
- position = 0;
- }
-
- /**
- * Flushes the stream and forces any buffered bytes to be written. This
- * does not flush the underlying OutputStream.
- */
- public void flush() throws IOException {
- if (output != null) {
- refreshBuffer();
- }
- }
-
- /**
- * If writing to a flat array, return the space left in the array.
- * Otherwise, throws {@code UnsupportedOperationException}.
- */
- public int spaceLeft() {
- if (output == null) {
- return limit - position;
- } else {
- throw new UnsupportedOperationException(
- "spaceLeft() can only be called on CodedOutputStreams that are " +
- "writing to a flat array.");
- }
- }
-
- /**
- * Verifies that {@link #spaceLeft()} returns zero. It's common to create
- * a byte array that is exactly big enough to hold a message, then write to
- * it with a {@code CodedOutputStream}. Calling {@code checkNoSpaceLeft()}
- * after writing verifies that the message was actually as big as expected,
- * which can help catch bugs.
- */
- public void checkNoSpaceLeft() {
- if (spaceLeft() != 0) {
- throw new IllegalStateException(
- "Did not write as much data as expected.");
- }
- }
-
- /**
- * If you create a CodedOutputStream around a simple flat array, you must
- * not attempt to write more bytes than the array has space. Otherwise,
- * this exception will be thrown.
- */
- public static class OutOfSpaceException extends IOException {
- private static final long serialVersionUID = -6947486886997889499L;
-
- OutOfSpaceException() {
- super("CodedOutputStream was writing to a flat byte array and ran " +
- "out of space.");
- }
- }
-
- /** Write a single byte. */
- public void writeRawByte(final byte value) throws IOException {
- if (position == limit) {
- refreshBuffer();
- }
-
- buffer[position++] = value;
- }
-
- /** Write a single byte, represented by an integer value. */
- public void writeRawByte(final int value) throws IOException {
- writeRawByte((byte) value);
- }
-
- /** Write a byte string. */
- public void writeRawBytes(final ByteString value) throws IOException {
- writeRawBytes(value, 0, value.size());
- }
-
- /** Write an array of bytes. */
- public void writeRawBytes(final byte[] value) throws IOException {
- writeRawBytes(value, 0, value.length);
- }
-
- /** Write part of an array of bytes. */
- public void writeRawBytes(final byte[] value, int offset, int length)
- throws IOException {
- if (limit - position >= length) {
- // We have room in the current buffer.
- System.arraycopy(value, offset, buffer, position, length);
- position += length;
- } else {
- // Write extends past current buffer. Fill the rest of this buffer and
- // flush.
- final int bytesWritten = limit - position;
- System.arraycopy(value, offset, buffer, position, bytesWritten);
- offset += bytesWritten;
- length -= bytesWritten;
- position = limit;
- refreshBuffer();
-
- // Now deal with the rest.
- // Since we have an output stream, this is our buffer
- // and buffer offset == 0
- if (length <= limit) {
- // Fits in new buffer.
- System.arraycopy(value, offset, buffer, 0, length);
- position = length;
- } else {
- // Write is very big. Let's do it all at once.
- output.write(value, offset, length);
- }
- }
- }
-
- /** Write part of a byte string. */
- public void writeRawBytes(final ByteString value, int offset, int length)
- throws IOException {
- if (limit - position >= length) {
- // We have room in the current buffer.
- value.copyTo(buffer, offset, position, length);
- position += length;
- } else {
- // Write extends past current buffer. Fill the rest of this buffer and
- // flush.
- final int bytesWritten = limit - position;
- value.copyTo(buffer, offset, position, bytesWritten);
- offset += bytesWritten;
- length -= bytesWritten;
- position = limit;
- refreshBuffer();
-
- // Now deal with the rest.
- // Since we have an output stream, this is our buffer
- // and buffer offset == 0
- if (length <= limit) {
- // Fits in new buffer.
- value.copyTo(buffer, offset, 0, length);
- position = length;
- } else {
- // Write is very big, but we can't do it all at once without allocating
- // an a copy of the byte array since ByteString does not give us access
- // to the underlying bytes. Use the InputStream interface on the
- // ByteString and our buffer to copy between the two.
- InputStream inputStreamFrom = value.newInput();
- if (offset != inputStreamFrom.skip(offset)) {
- throw new IllegalStateException("Skip failed? Should never happen.");
- }
- // Use the buffer as the temporary buffer to avoid allocating memory.
- while (length > 0) {
- int bytesToRead = Math.min(length, limit);
- int bytesRead = inputStreamFrom.read(buffer, 0, bytesToRead);
- if (bytesRead != bytesToRead) {
- throw new IllegalStateException("Read failed? Should never happen");
- }
- output.write(buffer, 0, bytesRead);
- length -= bytesRead;
- }
- }
- }
- }
-
- /** Encode and write a tag. */
- public void writeTag(final int fieldNumber, final int wireType)
- throws IOException {
- writeRawVarint32(WireFormat.makeTag(fieldNumber, wireType));
- }
-
- /** Compute the number of bytes that would be needed to encode a tag. */
- public static int computeTagSize(final int fieldNumber) {
- return computeRawVarint32Size(WireFormat.makeTag(fieldNumber, 0));
- }
-
- /**
- * Encode and write a varint. {@code value} is treated as
- * unsigned, so it won't be sign-extended if negative.
- */
- public void writeRawVarint32(int value) throws IOException {
- while (true) {
- if ((value & ~0x7F) == 0) {
- writeRawByte(value);
- return;
- } else {
- writeRawByte((value & 0x7F) | 0x80);
- value >>>= 7;
- }
- }
- }
-
- /**
- * Compute the number of bytes that would be needed to encode a varint.
- * {@code value} is treated as unsigned, so it won't be sign-extended if
- * negative.
- */
- public static int computeRawVarint32Size(final int value) {
- if ((value & (0xffffffff << 7)) == 0) return 1;
- if ((value & (0xffffffff << 14)) == 0) return 2;
- if ((value & (0xffffffff << 21)) == 0) return 3;
- if ((value & (0xffffffff << 28)) == 0) return 4;
- return 5;
- }
-
- /** Encode and write a varint. */
- public void writeRawVarint64(long value) throws IOException {
- while (true) {
- if ((value & ~0x7FL) == 0) {
- writeRawByte((int)value);
- return;
- } else {
- writeRawByte(((int)value & 0x7F) | 0x80);
- value >>>= 7;
- }
- }
- }
-
- /** Compute the number of bytes that would be needed to encode a varint. */
- public static int computeRawVarint64Size(final long value) {
- if ((value & (0xffffffffffffffffL << 7)) == 0) return 1;
- if ((value & (0xffffffffffffffffL << 14)) == 0) return 2;
- if ((value & (0xffffffffffffffffL << 21)) == 0) return 3;
- if ((value & (0xffffffffffffffffL << 28)) == 0) return 4;
- if ((value & (0xffffffffffffffffL << 35)) == 0) return 5;
- if ((value & (0xffffffffffffffffL << 42)) == 0) return 6;
- if ((value & (0xffffffffffffffffL << 49)) == 0) return 7;
- if ((value & (0xffffffffffffffffL << 56)) == 0) return 8;
- if ((value & (0xffffffffffffffffL << 63)) == 0) return 9;
- return 10;
- }
-
- /** Write a little-endian 32-bit integer. */
- public void writeRawLittleEndian32(final int value) throws IOException {
- writeRawByte((value ) & 0xFF);
- writeRawByte((value >> 8) & 0xFF);
- writeRawByte((value >> 16) & 0xFF);
- writeRawByte((value >> 24) & 0xFF);
- }
-
- public static final int LITTLE_ENDIAN_32_SIZE = 4;
-
- /** Write a little-endian 64-bit integer. */
- public void writeRawLittleEndian64(final long value) throws IOException {
- writeRawByte((int)(value ) & 0xFF);
- writeRawByte((int)(value >> 8) & 0xFF);
- writeRawByte((int)(value >> 16) & 0xFF);
- writeRawByte((int)(value >> 24) & 0xFF);
- writeRawByte((int)(value >> 32) & 0xFF);
- writeRawByte((int)(value >> 40) & 0xFF);
- writeRawByte((int)(value >> 48) & 0xFF);
- writeRawByte((int)(value >> 56) & 0xFF);
- }
-
- public static final int LITTLE_ENDIAN_64_SIZE = 8;
-
- /**
- * Encode a ZigZag-encoded 32-bit value. ZigZag encodes signed integers
- * into values that can be efficiently encoded with varint. (Otherwise,
- * negative values must be sign-extended to 64 bits to be varint encoded,
- * thus always taking 10 bytes on the wire.)
- *
- * @param n A signed 32-bit integer.
- * @return An unsigned 32-bit integer, stored in a signed int because
- * Java has no explicit unsigned support.
- */
- public static int encodeZigZag32(final int n) {
- // Note: the right-shift must be arithmetic
- return (n << 1) ^ (n >> 31);
- }
-
- /**
- * Encode a ZigZag-encoded 64-bit value. ZigZag encodes signed integers
- * into values that can be efficiently encoded with varint. (Otherwise,
- * negative values must be sign-extended to 64 bits to be varint encoded,
- * thus always taking 10 bytes on the wire.)
- *
- * @param n A signed 64-bit integer.
- * @return An unsigned 64-bit integer, stored in a signed int because
- * Java has no explicit unsigned support.
- */
- public static long encodeZigZag64(final long n) {
- // Note: the right-shift must be arithmetic
- return (n << 1) ^ (n >> 63);
- }
-}
diff --git a/protobuf/src/main/java/org/apache/pekko/protobuf/DescriptorProtos.java b/protobuf/src/main/java/org/apache/pekko/protobuf/DescriptorProtos.java
deleted file mode 100644
index 8d0300f3e4..0000000000
--- a/protobuf/src/main/java/org/apache/pekko/protobuf/DescriptorProtos.java
+++ /dev/null
@@ -1,28513 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * license agreements; and to You under the Apache License, version 2.0:
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * This file is part of the Apache Pekko project, which was derived from Akka.
- */
-
-/*
- * Copyright (C) 2018-2022 Lightbend Inc. <https://www.lightbend.com>
- */
-
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: google/protobuf/descriptor.proto
-
-package org.apache.pekko.protobuf;
-
-public final class DescriptorProtos {
- private DescriptorProtos() {}
- public static void registerAllExtensions(
- org.apache.pekko.protobuf.ExtensionRegistry registry) {
- }
- public interface FileDescriptorSetOrBuilder
- extends org.apache.pekko.protobuf.MessageOrBuilder {
-
- // repeated .google.protobuf.FileDescriptorProto file = 1;
- /**
- * <code>repeated .google.protobuf.FileDescriptorProto file = 1;</code>
- */
- java.util.List<org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto>
- getFileList();
- /**
- * <code>repeated .google.protobuf.FileDescriptorProto file = 1;</code>
- */
- org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto getFile(int index);
- /**
- * <code>repeated .google.protobuf.FileDescriptorProto file = 1;</code>
- */
- int getFileCount();
- /**
- * <code>repeated .google.protobuf.FileDescriptorProto file = 1;</code>
- */
- java.util.List<? extends org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProtoOrBuilder>
- getFileOrBuilderList();
- /**
- * <code>repeated .google.protobuf.FileDescriptorProto file = 1;</code>
- */
- org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProtoOrBuilder getFileOrBuilder(
- int index);
- }
- /**
- * Protobuf type {@code google.protobuf.FileDescriptorSet}
- *
- * <pre>
- * The protocol compiler can output a FileDescriptorSet containing the .proto
- * files it parses.
- * </pre>
- */
- public static final class FileDescriptorSet extends
- org.apache.pekko.protobuf.GeneratedMessage
- implements FileDescriptorSetOrBuilder {
- // Use FileDescriptorSet.newBuilder() to construct.
- private FileDescriptorSet(org.apache.pekko.protobuf.GeneratedMessage.Builder<?> builder) {
- super(builder);
- this.unknownFields = builder.getUnknownFields();
- }
- private FileDescriptorSet(boolean noInit) { this.unknownFields = org.apache.pekko.protobuf.UnknownFieldSet.getDefaultInstance(); }
-
- private static final FileDescriptorSet defaultInstance;
- public static FileDescriptorSet getDefaultInstance() {
- return defaultInstance;
- }
-
- public FileDescriptorSet getDefaultInstanceForType() {
- return defaultInstance;
- }
-
- private final org.apache.pekko.protobuf.UnknownFieldSet unknownFields;
- @java.lang.Override
- public final org.apache.pekko.protobuf.UnknownFieldSet
- getUnknownFields() {
- return this.unknownFields;
- }
- private FileDescriptorSet(
- org.apache.pekko.protobuf.CodedInputStream input,
- org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry)
- throws org.apache.pekko.protobuf.InvalidProtocolBufferException {
- initFields();
- int mutable_bitField0_ = 0;
- org.apache.pekko.protobuf.UnknownFieldSet.Builder unknownFields =
- org.apache.pekko.protobuf.UnknownFieldSet.newBuilder();
- try {
- boolean done = false;
- while (!done) {
- int tag = input.readTag();
- switch (tag) {
- case 0:
- done = true;
- break;
- default: {
- if (!parseUnknownField(input, unknownFields,
- extensionRegistry, tag)) {
- done = true;
- }
- break;
- }
- case 10: {
- if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
- file_ = new java.util.ArrayList<org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto>();
- mutable_bitField0_ |= 0x00000001;
- }
- file_.add(input.readMessage(org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto.PARSER, extensionRegistry));
- break;
- }
- }
- }
- } catch (org.apache.pekko.protobuf.InvalidProtocolBufferException e) {
- throw e.setUnfinishedMessage(this);
- } catch (java.io.IOException e) {
- throw new org.apache.pekko.protobuf.InvalidProtocolBufferException(
- e.getMessage()).setUnfinishedMessage(this);
- } finally {
- if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
- file_ = java.util.Collections.unmodifiableList(file_);
- }
- this.unknownFields = unknownFields.build();
- makeExtensionsImmutable();
- }
- }
- public static final org.apache.pekko.protobuf.Descriptors.Descriptor
- getDescriptor() {
- return org.apache.pekko.protobuf.DescriptorProtos.internal_static_google_protobuf_FileDescriptorSet_descriptor;
- }
-
- protected org.apache.pekko.protobuf.GeneratedMessage.FieldAccessorTable
- internalGetFieldAccessorTable() {
- return org.apache.pekko.protobuf.DescriptorProtos.internal_static_google_protobuf_FileDescriptorSet_fieldAccessorTable
- .ensureFieldAccessorsInitialized(
- org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet.class, org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet.Builder.class);
- }
-
- public static org.apache.pekko.protobuf.Parser<FileDescriptorSet> PARSER =
- new org.apache.pekko.protobuf.AbstractParser<FileDescriptorSet>() {
- public FileDescriptorSet parsePartialFrom(
- org.apache.pekko.protobuf.CodedInputStream input,
- org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry)
- throws org.apache.pekko.protobuf.InvalidProtocolBufferException {
- return new FileDescriptorSet(input, extensionRegistry);
- }
- };
-
- @java.lang.Override
- public org.apache.pekko.protobuf.Parser<FileDescriptorSet> getParserForType() {
- return PARSER;
- }
-
- // repeated .google.protobuf.FileDescriptorProto file = 1;
- public static final int FILE_FIELD_NUMBER = 1;
- private java.util.List<org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto> file_;
- /**
- * <code>repeated .google.protobuf.FileDescriptorProto file = 1;</code>
- */
- public java.util.List<org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto> getFileList() {
- return file_;
- }
- /**
- * <code>repeated .google.protobuf.FileDescriptorProto file = 1;</code>
- */
- public java.util.List<? extends org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProtoOrBuilder>
- getFileOrBuilderList() {
- return file_;
- }
- /**
- * <code>repeated .google.protobuf.FileDescriptorProto file = 1;</code>
- */
- public int getFileCount() {
- return file_.size();
- }
- /**
- * <code>repeated .google.protobuf.FileDescriptorProto file = 1;</code>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto getFile(int index) {
- return file_.get(index);
- }
- /**
- * <code>repeated .google.protobuf.FileDescriptorProto file = 1;</code>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProtoOrBuilder getFileOrBuilder(
- int index) {
- return file_.get(index);
- }
-
- private void initFields() {
- file_ = java.util.Collections.emptyList();
- }
- private byte memoizedIsInitialized = -1;
- public final boolean isInitialized() {
- byte isInitialized = memoizedIsInitialized;
- if (isInitialized != -1) return isInitialized == 1;
-
- for (int i = 0; i < getFileCount(); i++) {
- if (!getFile(i).isInitialized()) {
- memoizedIsInitialized = 0;
- return false;
- }
- }
- memoizedIsInitialized = 1;
- return true;
- }
-
- public void writeTo(org.apache.pekko.protobuf.CodedOutputStream output)
- throws java.io.IOException {
- getSerializedSize();
- for (int i = 0; i < file_.size(); i++) {
- output.writeMessage(1, file_.get(i));
- }
- getUnknownFields().writeTo(output);
- }
-
- private int memoizedSerializedSize = -1;
- public int getSerializedSize() {
- int size = memoizedSerializedSize;
- if (size != -1) return size;
-
- size = 0;
- for (int i = 0; i < file_.size(); i++) {
- size += org.apache.pekko.protobuf.CodedOutputStream
- .computeMessageSize(1, file_.get(i));
- }
- size += getUnknownFields().getSerializedSize();
- memoizedSerializedSize = size;
- return size;
- }
-
- private static final long serialVersionUID = 0L;
- @java.lang.Override
- protected java.lang.Object writeReplace()
- throws java.io.ObjectStreamException {
- return super.writeReplace();
- }
-
- public static org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet parseFrom(
- org.apache.pekko.protobuf.ByteString data)
- throws org.apache.pekko.protobuf.InvalidProtocolBufferException {
- return PARSER.parseFrom(data);
- }
- public static org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet parseFrom(
- org.apache.pekko.protobuf.ByteString data,
- org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry)
- throws org.apache.pekko.protobuf.InvalidProtocolBufferException {
- return PARSER.parseFrom(data, extensionRegistry);
- }
- public static org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet parseFrom(byte[] data)
- throws org.apache.pekko.protobuf.InvalidProtocolBufferException {
- return PARSER.parseFrom(data);
- }
- public static org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet parseFrom(
- byte[] data,
- org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry)
- throws org.apache.pekko.protobuf.InvalidProtocolBufferException {
- return PARSER.parseFrom(data, extensionRegistry);
- }
- public static org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet parseFrom(java.io.InputStream input)
- throws java.io.IOException {
- return PARSER.parseFrom(input);
- }
- public static org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet parseFrom(
- java.io.InputStream input,
- org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry)
- throws java.io.IOException {
- return PARSER.parseFrom(input, extensionRegistry);
- }
- public static org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet parseDelimitedFrom(java.io.InputStream input)
- throws java.io.IOException {
- return PARSER.parseDelimitedFrom(input);
- }
- public static org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet parseDelimitedFrom(
- java.io.InputStream input,
- org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry)
- throws java.io.IOException {
- return PARSER.parseDelimitedFrom(input, extensionRegistry);
- }
- public static org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet parseFrom(
- org.apache.pekko.protobuf.CodedInputStream input)
- throws java.io.IOException {
- return PARSER.parseFrom(input);
- }
- public static org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet parseFrom(
- org.apache.pekko.protobuf.CodedInputStream input,
- org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry)
- throws java.io.IOException {
- return PARSER.parseFrom(input, extensionRegistry);
- }
-
- public static Builder newBuilder() { return Builder.create(); }
- public Builder newBuilderForType() { return newBuilder(); }
- public static Builder newBuilder(org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet prototype) {
- return newBuilder().mergeFrom(prototype);
- }
- public Builder toBuilder() { return newBuilder(this); }
-
- @java.lang.Override
- protected Builder newBuilderForType(
- org.apache.pekko.protobuf.GeneratedMessage.BuilderParent parent) {
- Builder builder = new Builder(parent);
- return builder;
- }
- /**
- * Protobuf type {@code google.protobuf.FileDescriptorSet}
- *
- * <pre>
- * The protocol compiler can output a FileDescriptorSet containing the .proto
- * files it parses.
- * </pre>
- */
- public static final class Builder extends
- org.apache.pekko.protobuf.GeneratedMessage.Builder<Builder>
- implements org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSetOrBuilder {
- public static final org.apache.pekko.protobuf.Descriptors.Descriptor
- getDescriptor() {
- return org.apache.pekko.protobuf.DescriptorProtos.internal_static_google_protobuf_FileDescriptorSet_descriptor;
- }
-
- protected org.apache.pekko.protobuf.GeneratedMessage.FieldAccessorTable
- internalGetFieldAccessorTable() {
- return org.apache.pekko.protobuf.DescriptorProtos.internal_static_google_protobuf_FileDescriptorSet_fieldAccessorTable
- .ensureFieldAccessorsInitialized(
- org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet.class, org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet.Builder.class);
- }
-
- // Construct using org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet.newBuilder()
- private Builder() {
- maybeForceBuilderInitialization();
- }
-
- private Builder(
- org.apache.pekko.protobuf.GeneratedMessage.BuilderParent parent) {
- super(parent);
- maybeForceBuilderInitialization();
- }
- private void maybeForceBuilderInitialization() {
- if (org.apache.pekko.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
- getFileFieldBuilder();
- }
- }
- private static Builder create() {
- return new Builder();
- }
-
- public Builder clear() {
- super.clear();
- if (fileBuilder_ == null) {
- file_ = java.util.Collections.emptyList();
- bitField0_ = (bitField0_ & ~0x00000001);
- } else {
- fileBuilder_.clear();
- }
- return this;
- }
-
- public Builder clone() {
- return create().mergeFrom(buildPartial());
- }
-
- public org.apache.pekko.protobuf.Descriptors.Descriptor
- getDescriptorForType() {
- return org.apache.pekko.protobuf.DescriptorProtos.internal_static_google_protobuf_FileDescriptorSet_descriptor;
- }
-
- public org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet getDefaultInstanceForType() {
- return org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet.getDefaultInstance();
- }
-
- public org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet build() {
- org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet result = buildPartial();
- if (!result.isInitialized()) {
- throw newUninitializedMessageException(result);
- }
- return result;
- }
-
- public org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet buildPartial() {
- org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet result = new org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet(this);
- int from_bitField0_ = bitField0_;
- if (fileBuilder_ == null) {
- if (((bitField0_ & 0x00000001) == 0x00000001)) {
- file_ = java.util.Collections.unmodifiableList(file_);
- bitField0_ = (bitField0_ & ~0x00000001);
- }
- result.file_ = file_;
- } else {
- result.file_ = fileBuilder_.build();
- }
- onBuilt();
- return result;
- }
-
- public Builder mergeFrom(org.apache.pekko.protobuf.Message other) {
- if (other instanceof org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet) {
- return mergeFrom((org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet)other);
- } else {
- super.mergeFrom(other);
- return this;
- }
- }
-
- public Builder mergeFrom(org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet other) {
- if (other == org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet.getDefaultInstance()) return this;
- if (fileBuilder_ == null) {
- if (!other.file_.isEmpty()) {
- if (file_.isEmpty()) {
- file_ = other.file_;
- bitField0_ = (bitField0_ & ~0x00000001);
- } else {
- ensureFileIsMutable();
- file_.addAll(other.file_);
- }
- onChanged();
- }
- } else {
- if (!other.file_.isEmpty()) {
- if (fileBuilder_.isEmpty()) {
- fileBuilder_.dispose();
- fileBuilder_ = null;
- file_ = other.file_;
- bitField0_ = (bitField0_ & ~0x00000001);
- fileBuilder_ =
- org.apache.pekko.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
- getFileFieldBuilder() : null;
- } else {
- fileBuilder_.addAllMessages(other.file_);
- }
- }
- }
- this.mergeUnknownFields(other.getUnknownFields());
- return this;
- }
-
- public final boolean isInitialized() {
- for (int i = 0; i < getFileCount(); i++) {
- if (!getFile(i).isInitialized()) {
-
- return false;
- }
- }
- return true;
- }
-
- public Builder mergeFrom(
- org.apache.pekko.protobuf.CodedInputStream input,
- org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry)
- throws java.io.IOException {
- org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet parsedMessage = null;
- try {
- parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
- } catch (org.apache.pekko.protobuf.InvalidProtocolBufferException e) {
- parsedMessage = (org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorSet) e.getUnfinishedMessage();
- throw e;
- } finally {
- if (parsedMessage != null) {
- mergeFrom(parsedMessage);
- }
- }
- return this;
- }
- private int bitField0_;
-
- // repeated .google.protobuf.FileDescriptorProto file = 1;
- private java.util.List<org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto> file_ =
- java.util.Collections.emptyList();
- private void ensureFileIsMutable() {
- if (!((bitField0_ & 0x00000001) == 0x00000001)) {
- file_ = new java.util.ArrayList<org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto>(file_);
- bitField0_ |= 0x00000001;
- }
- }
-
- private org.apache.pekko.protobuf.RepeatedFieldBuilder<
- org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProtoOrBuilder> fileBuilder_;
-
- /**
- * <code>repeated .google.protobuf.FileDescriptorProto file = 1;</code>
- */
- public java.util.List<org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto> getFileList() {
- if (fileBuilder_ == null) {
- return java.util.Collections.unmodifiableList(file_);
- } else {
- return fileBuilder_.getMessageList();
- }
- }
- /**
- * <code>repeated .google.protobuf.FileDescriptorProto file = 1;</code>
- */
- public int getFileCount() {
- if (fileBuilder_ == null) {
- return file_.size();
- } else {
- return fileBuilder_.getCount();
- }
- }
- /**
- * <code>repeated .google.protobuf.FileDescriptorProto file = 1;</code>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto getFile(int index) {
- if (fileBuilder_ == null) {
- return file_.get(index);
- } else {
- return fileBuilder_.getMessage(index);
- }
- }
- /**
- * <code>repeated .google.protobuf.FileDescriptorProto file = 1;</code>
- */
- public Builder setFile(
- int index, org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto value) {
- if (fileBuilder_ == null) {
- if (value == null) {
- throw new NullPointerException();
- }
- ensureFileIsMutable();
- file_.set(index, value);
- onChanged();
- } else {
- fileBuilder_.setMessage(index, value);
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.FileDescriptorProto file = 1;</code>
- */
- public Builder setFile(
- int index, org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto.Builder builderForValue) {
- if (fileBuilder_ == null) {
- ensureFileIsMutable();
- file_.set(index, builderForValue.build());
- onChanged();
- } else {
- fileBuilder_.setMessage(index, builderForValue.build());
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.FileDescriptorProto file = 1;</code>
- */
- public Builder addFile(org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto value) {
- if (fileBuilder_ == null) {
- if (value == null) {
- throw new NullPointerException();
- }
- ensureFileIsMutable();
- file_.add(value);
- onChanged();
- } else {
- fileBuilder_.addMessage(value);
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.FileDescriptorProto file = 1;</code>
- */
- public Builder addFile(
- int index, org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto value) {
- if (fileBuilder_ == null) {
- if (value == null) {
- throw new NullPointerException();
- }
- ensureFileIsMutable();
- file_.add(index, value);
- onChanged();
- } else {
- fileBuilder_.addMessage(index, value);
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.FileDescriptorProto file = 1;</code>
- */
- public Builder addFile(
- org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto.Builder builderForValue) {
- if (fileBuilder_ == null) {
- ensureFileIsMutable();
- file_.add(builderForValue.build());
- onChanged();
- } else {
- fileBuilder_.addMessage(builderForValue.build());
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.FileDescriptorProto file = 1;</code>
- */
- public Builder addFile(
- int index, org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto.Builder builderForValue) {
- if (fileBuilder_ == null) {
- ensureFileIsMutable();
- file_.add(index, builderForValue.build());
- onChanged();
- } else {
- fileBuilder_.addMessage(index, builderForValue.build());
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.FileDescriptorProto file = 1;</code>
- */
- public Builder addAllFile(
- java.lang.Iterable<? extends org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto> values) {
- if (fileBuilder_ == null) {
- ensureFileIsMutable();
- super.addAll(values, file_);
- onChanged();
- } else {
- fileBuilder_.addAllMessages(values);
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.FileDescriptorProto file = 1;</code>
- */
- public Builder clearFile() {
- if (fileBuilder_ == null) {
- file_ = java.util.Collections.emptyList();
- bitField0_ = (bitField0_ & ~0x00000001);
- onChanged();
- } else {
- fileBuilder_.clear();
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.FileDescriptorProto file = 1;</code>
- */
- public Builder removeFile(int index) {
- if (fileBuilder_ == null) {
- ensureFileIsMutable();
- file_.remove(index);
- onChanged();
- } else {
- fileBuilder_.remove(index);
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.FileDescriptorProto file = 1;</code>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto.Builder getFileBuilder(
- int index) {
- return getFileFieldBuilder().getBuilder(index);
- }
- /**
- * <code>repeated .google.protobuf.FileDescriptorProto file = 1;</code>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProtoOrBuilder getFileOrBuilder(
- int index) {
- if (fileBuilder_ == null) {
- return file_.get(index); } else {
- return fileBuilder_.getMessageOrBuilder(index);
- }
- }
- /**
- * <code>repeated .google.protobuf.FileDescriptorProto file = 1;</code>
- */
- public java.util.List<? extends org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProtoOrBuilder>
- getFileOrBuilderList() {
- if (fileBuilder_ != null) {
- return fileBuilder_.getMessageOrBuilderList();
- } else {
- return java.util.Collections.unmodifiableList(file_);
- }
- }
- /**
- * <code>repeated .google.protobuf.FileDescriptorProto file = 1;</code>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto.Builder addFileBuilder() {
- return getFileFieldBuilder().addBuilder(
- org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto.getDefaultInstance());
- }
- /**
- * <code>repeated .google.protobuf.FileDescriptorProto file = 1;</code>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto.Builder addFileBuilder(
- int index) {
- return getFileFieldBuilder().addBuilder(
- index, org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto.getDefaultInstance());
- }
- /**
- * <code>repeated .google.protobuf.FileDescriptorProto file = 1;</code>
- */
- public java.util.List<org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto.Builder>
- getFileBuilderList() {
- return getFileFieldBuilder().getBuilderList();
- }
- private org.apache.pekko.protobuf.RepeatedFieldBuilder<
- org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProtoOrBuilder>
- getFileFieldBuilder() {
- if (fileBuilder_ == null) {
- fileBuilder_ = new org.apache.pekko.protobuf.RepeatedFieldBuilder<
- org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProtoOrBuilder>(
- file_,
- ((bitField0_ & 0x00000001) == 0x00000001),
- getParentForChildren(),
- isClean());
- file_ = null;
- }
- return fileBuilder_;
- }
-
- // @@protoc_insertion_point(builder_scope:google.protobuf.FileDescriptorSet)
- }
-
- static {
- defaultInstance = new FileDescriptorSet(true);
- defaultInstance.initFields();
- }
-
- // @@protoc_insertion_point(class_scope:google.protobuf.FileDescriptorSet)
- }
-
- public interface FileDescriptorProtoOrBuilder
- extends org.apache.pekko.protobuf.MessageOrBuilder {
-
- // optional string name = 1;
- /**
- * <code>optional string name = 1;</code>
- *
- * <pre>
- * file name, relative to root of source tree
- * </pre>
- */
- boolean hasName();
- /**
- * <code>optional string name = 1;</code>
- *
- * <pre>
- * file name, relative to root of source tree
- * </pre>
- */
- java.lang.String getName();
- /**
- * <code>optional string name = 1;</code>
- *
- * <pre>
- * file name, relative to root of source tree
- * </pre>
- */
- org.apache.pekko.protobuf.ByteString
- getNameBytes();
-
- // optional string package = 2;
- /**
- * <code>optional string package = 2;</code>
- *
- * <pre>
- * e.g. "foo", "foo.bar", etc.
- * </pre>
- */
- boolean hasPackage();
- /**
- * <code>optional string package = 2;</code>
- *
- * <pre>
- * e.g. "foo", "foo.bar", etc.
- * </pre>
- */
- java.lang.String getPackage();
- /**
- * <code>optional string package = 2;</code>
- *
- * <pre>
- * e.g. "foo", "foo.bar", etc.
- * </pre>
- */
- org.apache.pekko.protobuf.ByteString
- getPackageBytes();
-
- // repeated string dependency = 3;
- /**
- * <code>repeated string dependency = 3;</code>
- *
- * <pre>
- * Names of files imported by this file.
- * </pre>
- */
- java.util.List<java.lang.String>
- getDependencyList();
- /**
- * <code>repeated string dependency = 3;</code>
- *
- * <pre>
- * Names of files imported by this file.
- * </pre>
- */
- int getDependencyCount();
- /**
- * <code>repeated string dependency = 3;</code>
- *
- * <pre>
- * Names of files imported by this file.
- * </pre>
- */
- java.lang.String getDependency(int index);
- /**
- * <code>repeated string dependency = 3;</code>
- *
- * <pre>
- * Names of files imported by this file.
- * </pre>
- */
- org.apache.pekko.protobuf.ByteString
- getDependencyBytes(int index);
-
- // repeated int32 public_dependency = 10;
- /**
- * <code>repeated int32 public_dependency = 10;</code>
- *
- * <pre>
- * Indexes of the public imported files in the dependency list above.
- * </pre>
- */
- java.util.List<java.lang.Integer> getPublicDependencyList();
- /**
- * <code>repeated int32 public_dependency = 10;</code>
- *
- * <pre>
- * Indexes of the public imported files in the dependency list above.
- * </pre>
- */
- int getPublicDependencyCount();
- /**
- * <code>repeated int32 public_dependency = 10;</code>
- *
- * <pre>
- * Indexes of the public imported files in the dependency list above.
- * </pre>
- */
- int getPublicDependency(int index);
-
- // repeated int32 weak_dependency = 11;
- /**
- * <code>repeated int32 weak_dependency = 11;</code>
- *
- * <pre>
- * Indexes of the weak imported files in the dependency list.
- * For Google-internal migration only. Do not use.
- * </pre>
- */
- java.util.List<java.lang.Integer> getWeakDependencyList();
- /**
- * <code>repeated int32 weak_dependency = 11;</code>
- *
- * <pre>
- * Indexes of the weak imported files in the dependency list.
- * For Google-internal migration only. Do not use.
- * </pre>
- */
- int getWeakDependencyCount();
- /**
- * <code>repeated int32 weak_dependency = 11;</code>
- *
- * <pre>
- * Indexes of the weak imported files in the dependency list.
- * For Google-internal migration only. Do not use.
- * </pre>
- */
- int getWeakDependency(int index);
-
- // repeated .google.protobuf.DescriptorProto message_type = 4;
- /**
- * <code>repeated .google.protobuf.DescriptorProto message_type = 4;</code>
- *
- * <pre>
- * All top-level definitions in this file.
- * </pre>
- */
- java.util.List<org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto>
- getMessageTypeList();
- /**
- * <code>repeated .google.protobuf.DescriptorProto message_type = 4;</code>
- *
- * <pre>
- * All top-level definitions in this file.
- * </pre>
- */
- org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto getMessageType(int index);
- /**
- * <code>repeated .google.protobuf.DescriptorProto message_type = 4;</code>
- *
- * <pre>
- * All top-level definitions in this file.
- * </pre>
- */
- int getMessageTypeCount();
- /**
- * <code>repeated .google.protobuf.DescriptorProto message_type = 4;</code>
- *
- * <pre>
- * All top-level definitions in this file.
- * </pre>
- */
- java.util.List<? extends org.apache.pekko.protobuf.DescriptorProtos.DescriptorProtoOrBuilder>
- getMessageTypeOrBuilderList();
- /**
- * <code>repeated .google.protobuf.DescriptorProto message_type = 4;</code>
- *
- * <pre>
- * All top-level definitions in this file.
- * </pre>
- */
- org.apache.pekko.protobuf.DescriptorProtos.DescriptorProtoOrBuilder getMessageTypeOrBuilder(
- int index);
-
- // repeated .google.protobuf.EnumDescriptorProto enum_type = 5;
- /**
- * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 5;</code>
- */
- java.util.List<org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto>
- getEnumTypeList();
- /**
- * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 5;</code>
- */
- org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto getEnumType(int index);
- /**
- * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 5;</code>
- */
- int getEnumTypeCount();
- /**
- * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 5;</code>
- */
- java.util.List<? extends org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProtoOrBuilder>
- getEnumTypeOrBuilderList();
- /**
- * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 5;</code>
- */
- org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProtoOrBuilder getEnumTypeOrBuilder(
- int index);
-
- // repeated .google.protobuf.ServiceDescriptorProto service = 6;
- /**
- * <code>repeated .google.protobuf.ServiceDescriptorProto service = 6;</code>
- */
- java.util.List<org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto>
- getServiceList();
- /**
- * <code>repeated .google.protobuf.ServiceDescriptorProto service = 6;</code>
- */
- org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto getService(int index);
- /**
- * <code>repeated .google.protobuf.ServiceDescriptorProto service = 6;</code>
- */
- int getServiceCount();
- /**
- * <code>repeated .google.protobuf.ServiceDescriptorProto service = 6;</code>
- */
- java.util.List<? extends org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProtoOrBuilder>
- getServiceOrBuilderList();
- /**
- * <code>repeated .google.protobuf.ServiceDescriptorProto service = 6;</code>
- */
- org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProtoOrBuilder getServiceOrBuilder(
- int index);
-
- // repeated .google.protobuf.FieldDescriptorProto extension = 7;
- /**
- * <code>repeated .google.protobuf.FieldDescriptorProto extension = 7;</code>
- */
- java.util.List<org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto>
- getExtensionList();
- /**
- * <code>repeated .google.protobuf.FieldDescriptorProto extension = 7;</code>
- */
- org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto getExtension(int index);
- /**
- * <code>repeated .google.protobuf.FieldDescriptorProto extension = 7;</code>
- */
- int getExtensionCount();
- /**
- * <code>repeated .google.protobuf.FieldDescriptorProto extension = 7;</code>
- */
- java.util.List<? extends org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProtoOrBuilder>
- getExtensionOrBuilderList();
- /**
- * <code>repeated .google.protobuf.FieldDescriptorProto extension = 7;</code>
- */
- org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProtoOrBuilder getExtensionOrBuilder(
- int index);
-
- // optional .google.protobuf.FileOptions options = 8;
- /**
- * <code>optional .google.protobuf.FileOptions options = 8;</code>
- */
- boolean hasOptions();
- /**
- * <code>optional .google.protobuf.FileOptions options = 8;</code>
- */
- org.apache.pekko.protobuf.DescriptorProtos.FileOptions getOptions();
- /**
- * <code>optional .google.protobuf.FileOptions options = 8;</code>
- */
- org.apache.pekko.protobuf.DescriptorProtos.FileOptionsOrBuilder getOptionsOrBuilder();
-
- // optional .google.protobuf.SourceCodeInfo source_code_info = 9;
- /**
- * <code>optional .google.protobuf.SourceCodeInfo source_code_info = 9;</code>
- *
- * <pre>
- * This field contains optional information about the original source code.
- * You may safely remove this entire field whithout harming runtime
- * functionality of the descriptors -- the information is needed only by
- * development tools.
- * </pre>
- */
- boolean hasSourceCodeInfo();
- /**
- * <code>optional .google.protobuf.SourceCodeInfo source_code_info = 9;</code>
- *
- * <pre>
- * This field contains optional information about the original source code.
- * You may safely remove this entire field whithout harming runtime
- * functionality of the descriptors -- the information is needed only by
- * development tools.
- * </pre>
- */
- org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo getSourceCodeInfo();
- /**
- * <code>optional .google.protobuf.SourceCodeInfo source_code_info = 9;</code>
- *
- * <pre>
- * This field contains optional information about the original source code.
- * You may safely remove this entire field whithout harming runtime
- * functionality of the descriptors -- the information is needed only by
- * development tools.
- * </pre>
- */
- org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfoOrBuilder getSourceCodeInfoOrBuilder();
- }
- /**
- * Protobuf type {@code google.protobuf.FileDescriptorProto}
- *
- * <pre>
- * Describes a complete .proto file.
- * </pre>
- */
- public static final class FileDescriptorProto extends
- org.apache.pekko.protobuf.GeneratedMessage
- implements FileDescriptorProtoOrBuilder {
- // Use FileDescriptorProto.newBuilder() to construct.
- private FileDescriptorProto(org.apache.pekko.protobuf.GeneratedMessage.Builder<?> builder) {
- super(builder);
- this.unknownFields = builder.getUnknownFields();
- }
- private FileDescriptorProto(boolean noInit) { this.unknownFields = org.apache.pekko.protobuf.UnknownFieldSet.getDefaultInstance(); }
-
- private static final FileDescriptorProto defaultInstance;
- public static FileDescriptorProto getDefaultInstance() {
- return defaultInstance;
- }
-
- public FileDescriptorProto getDefaultInstanceForType() {
- return defaultInstance;
- }
-
- private final org.apache.pekko.protobuf.UnknownFieldSet unknownFields;
- @java.lang.Override
- public final org.apache.pekko.protobuf.UnknownFieldSet
- getUnknownFields() {
- return this.unknownFields;
- }
- private FileDescriptorProto(
- org.apache.pekko.protobuf.CodedInputStream input,
- org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry)
- throws org.apache.pekko.protobuf.InvalidProtocolBufferException {
- initFields();
- int mutable_bitField0_ = 0;
- org.apache.pekko.protobuf.UnknownFieldSet.Builder unknownFields =
- org.apache.pekko.protobuf.UnknownFieldSet.newBuilder();
- try {
- boolean done = false;
- while (!done) {
- int tag = input.readTag();
- switch (tag) {
- case 0:
- done = true;
- break;
- default: {
- if (!parseUnknownField(input, unknownFields,
- extensionRegistry, tag)) {
- done = true;
- }
- break;
- }
- case 10: {
- bitField0_ |= 0x00000001;
- name_ = input.readBytes();
- break;
- }
- case 18: {
- bitField0_ |= 0x00000002;
- package_ = input.readBytes();
- break;
- }
- case 26: {
- if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
- dependency_ = new org.apache.pekko.protobuf.LazyStringArrayList();
- mutable_bitField0_ |= 0x00000004;
- }
- dependency_.add(input.readBytes());
- break;
- }
- case 34: {
- if (!((mutable_bitField0_ & 0x00000020) == 0x00000020)) {
- messageType_ = new java.util.ArrayList<org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto>();
- mutable_bitField0_ |= 0x00000020;
- }
- messageType_.add(input.readMessage(org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.PARSER, extensionRegistry));
- break;
- }
- case 42: {
- if (!((mutable_bitField0_ & 0x00000040) == 0x00000040)) {
- enumType_ = new java.util.ArrayList<org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto>();
- mutable_bitField0_ |= 0x00000040;
- }
- enumType_.add(input.readMessage(org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto.PARSER, extensionRegistry));
- break;
- }
- case 50: {
- if (!((mutable_bitField0_ & 0x00000080) == 0x00000080)) {
- service_ = new java.util.ArrayList<org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto>();
- mutable_bitField0_ |= 0x00000080;
- }
- service_.add(input.readMessage(org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto.PARSER, extensionRegistry));
- break;
- }
- case 58: {
- if (!((mutable_bitField0_ & 0x00000100) == 0x00000100)) {
- extension_ = new java.util.ArrayList<org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto>();
- mutable_bitField0_ |= 0x00000100;
- }
- extension_.add(input.readMessage(org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.PARSER, extensionRegistry));
- break;
- }
- case 66: {
- org.apache.pekko.protobuf.DescriptorProtos.FileOptions.Builder subBuilder = null;
- if (((bitField0_ & 0x00000004) == 0x00000004)) {
- subBuilder = options_.toBuilder();
- }
- options_ = input.readMessage(org.apache.pekko.protobuf.DescriptorProtos.FileOptions.PARSER, extensionRegistry);
- if (subBuilder != null) {
- subBuilder.mergeFrom(options_);
- options_ = subBuilder.buildPartial();
- }
- bitField0_ |= 0x00000004;
- break;
- }
- case 74: {
- org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo.Builder subBuilder = null;
- if (((bitField0_ & 0x00000008) == 0x00000008)) {
- subBuilder = sourceCodeInfo_.toBuilder();
- }
- sourceCodeInfo_ = input.readMessage(org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo.PARSER, extensionRegistry);
- if (subBuilder != null) {
- subBuilder.mergeFrom(sourceCodeInfo_);
- sourceCodeInfo_ = subBuilder.buildPartial();
- }
- bitField0_ |= 0x00000008;
- break;
- }
- case 80: {
- if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
- publicDependency_ = new java.util.ArrayList<java.lang.Integer>();
- mutable_bitField0_ |= 0x00000008;
- }
- publicDependency_.add(input.readInt32());
- break;
- }
- case 82: {
- int length = input.readRawVarint32();
- int limit = input.pushLimit(length);
- if (!((mutable_bitField0_ & 0x00000008) == 0x00000008) && input.getBytesUntilLimit() > 0) {
- publicDependency_ = new java.util.ArrayList<java.lang.Integer>();
- mutable_bitField0_ |= 0x00000008;
- }
- while (input.getBytesUntilLimit() > 0) {
- publicDependency_.add(input.readInt32());
- }
- input.popLimit(limit);
- break;
- }
- case 88: {
- if (!((mutable_bitField0_ & 0x00000010) == 0x00000010)) {
- weakDependency_ = new java.util.ArrayList<java.lang.Integer>();
- mutable_bitField0_ |= 0x00000010;
- }
- weakDependency_.add(input.readInt32());
- break;
- }
- case 90: {
- int length = input.readRawVarint32();
- int limit = input.pushLimit(length);
- if (!((mutable_bitField0_ & 0x00000010) == 0x00000010) && input.getBytesUntilLimit() > 0) {
- weakDependency_ = new java.util.ArrayList<java.lang.Integer>();
- mutable_bitField0_ |= 0x00000010;
- }
- while (input.getBytesUntilLimit() > 0) {
- weakDependency_.add(input.readInt32());
- }
- input.popLimit(limit);
- break;
- }
- }
- }
- } catch (org.apache.pekko.protobuf.InvalidProtocolBufferException e) {
- throw e.setUnfinishedMessage(this);
- } catch (java.io.IOException e) {
- throw new org.apache.pekko.protobuf.InvalidProtocolBufferException(
- e.getMessage()).setUnfinishedMessage(this);
- } finally {
- if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
- dependency_ = new org.apache.pekko.protobuf.UnmodifiableLazyStringList(dependency_);
- }
- if (((mutable_bitField0_ & 0x00000020) == 0x00000020)) {
- messageType_ = java.util.Collections.unmodifiableList(messageType_);
- }
- if (((mutable_bitField0_ & 0x00000040) == 0x00000040)) {
- enumType_ = java.util.Collections.unmodifiableList(enumType_);
- }
- if (((mutable_bitField0_ & 0x00000080) == 0x00000080)) {
- service_ = java.util.Collections.unmodifiableList(service_);
- }
- if (((mutable_bitField0_ & 0x00000100) == 0x00000100)) {
- extension_ = java.util.Collections.unmodifiableList(extension_);
- }
- if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
- publicDependency_ = java.util.Collections.unmodifiableList(publicDependency_);
- }
- if (((mutable_bitField0_ & 0x00000010) == 0x00000010)) {
- weakDependency_ = java.util.Collections.unmodifiableList(weakDependency_);
- }
- this.unknownFields = unknownFields.build();
- makeExtensionsImmutable();
- }
- }
- public static final org.apache.pekko.protobuf.Descriptors.Descriptor
- getDescriptor() {
- return org.apache.pekko.protobuf.DescriptorProtos.internal_static_google_protobuf_FileDescriptorProto_descriptor;
- }
-
- protected org.apache.pekko.protobuf.GeneratedMessage.FieldAccessorTable
- internalGetFieldAccessorTable() {
- return org.apache.pekko.protobuf.DescriptorProtos.internal_static_google_protobuf_FileDescriptorProto_fieldAccessorTable
- .ensureFieldAccessorsInitialized(
- org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto.class, org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto.Builder.class);
- }
-
- public static org.apache.pekko.protobuf.Parser<FileDescriptorProto> PARSER =
- new org.apache.pekko.protobuf.AbstractParser<FileDescriptorProto>() {
- public FileDescriptorProto parsePartialFrom(
- org.apache.pekko.protobuf.CodedInputStream input,
- org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry)
- throws org.apache.pekko.protobuf.InvalidProtocolBufferException {
- return new FileDescriptorProto(input, extensionRegistry);
- }
- };
-
- @java.lang.Override
- public org.apache.pekko.protobuf.Parser<FileDescriptorProto> getParserForType() {
- return PARSER;
- }
-
- private int bitField0_;
- // optional string name = 1;
- public static final int NAME_FIELD_NUMBER = 1;
- private java.lang.Object name_;
- /**
- * <code>optional string name = 1;</code>
- *
- * <pre>
- * file name, relative to root of source tree
- * </pre>
- */
- public boolean hasName() {
- return ((bitField0_ & 0x00000001) == 0x00000001);
- }
- /**
- * <code>optional string name = 1;</code>
- *
- * <pre>
- * file name, relative to root of source tree
- * </pre>
- */
- public java.lang.String getName() {
- java.lang.Object ref = name_;
- if (ref instanceof java.lang.String) {
- return (java.lang.String) ref;
- } else {
- org.apache.pekko.protobuf.ByteString bs =
- (org.apache.pekko.protobuf.ByteString) ref;
- java.lang.String s = bs.toStringUtf8();
- if (bs.isValidUtf8()) {
- name_ = s;
- }
- return s;
- }
- }
- /**
- * <code>optional string name = 1;</code>
- *
- * <pre>
- * file name, relative to root of source tree
- * </pre>
- */
- public org.apache.pekko.protobuf.ByteString
- getNameBytes() {
- java.lang.Object ref = name_;
- if (ref instanceof java.lang.String) {
- org.apache.pekko.protobuf.ByteString b =
- org.apache.pekko.protobuf.ByteString.copyFromUtf8(
- (java.lang.String) ref);
- name_ = b;
- return b;
- } else {
- return (org.apache.pekko.protobuf.ByteString) ref;
- }
- }
-
- // optional string package = 2;
- public static final int PACKAGE_FIELD_NUMBER = 2;
- private java.lang.Object package_;
- /**
- * <code>optional string package = 2;</code>
- *
- * <pre>
- * e.g. "foo", "foo.bar", etc.
- * </pre>
- */
- public boolean hasPackage() {
- return ((bitField0_ & 0x00000002) == 0x00000002);
- }
- /**
- * <code>optional string package = 2;</code>
- *
- * <pre>
- * e.g. "foo", "foo.bar", etc.
- * </pre>
- */
- public java.lang.String getPackage() {
- java.lang.Object ref = package_;
- if (ref instanceof java.lang.String) {
- return (java.lang.String) ref;
- } else {
- org.apache.pekko.protobuf.ByteString bs =
- (org.apache.pekko.protobuf.ByteString) ref;
- java.lang.String s = bs.toStringUtf8();
- if (bs.isValidUtf8()) {
- package_ = s;
- }
- return s;
- }
- }
- /**
- * <code>optional string package = 2;</code>
- *
- * <pre>
- * e.g. "foo", "foo.bar", etc.
- * </pre>
- */
- public org.apache.pekko.protobuf.ByteString
- getPackageBytes() {
- java.lang.Object ref = package_;
- if (ref instanceof java.lang.String) {
- org.apache.pekko.protobuf.ByteString b =
- org.apache.pekko.protobuf.ByteString.copyFromUtf8(
- (java.lang.String) ref);
- package_ = b;
- return b;
- } else {
- return (org.apache.pekko.protobuf.ByteString) ref;
- }
- }
-
- // repeated string dependency = 3;
- public static final int DEPENDENCY_FIELD_NUMBER = 3;
- private org.apache.pekko.protobuf.LazyStringList dependency_;
- /**
- * <code>repeated string dependency = 3;</code>
- *
- * <pre>
- * Names of files imported by this file.
- * </pre>
- */
- public java.util.List<java.lang.String>
- getDependencyList() {
- return dependency_;
- }
- /**
- * <code>repeated string dependency = 3;</code>
- *
- * <pre>
- * Names of files imported by this file.
- * </pre>
- */
- public int getDependencyCount() {
- return dependency_.size();
- }
- /**
- * <code>repeated string dependency = 3;</code>
- *
- * <pre>
- * Names of files imported by this file.
- * </pre>
- */
- public java.lang.String getDependency(int index) {
- return dependency_.get(index);
- }
- /**
- * <code>repeated string dependency = 3;</code>
- *
- * <pre>
- * Names of files imported by this file.
- * </pre>
- */
- public org.apache.pekko.protobuf.ByteString
- getDependencyBytes(int index) {
- return dependency_.getByteString(index);
- }
-
- // repeated int32 public_dependency = 10;
- public static final int PUBLIC_DEPENDENCY_FIELD_NUMBER = 10;
- private java.util.List<java.lang.Integer> publicDependency_;
- /**
- * <code>repeated int32 public_dependency = 10;</code>
- *
- * <pre>
- * Indexes of the public imported files in the dependency list above.
- * </pre>
- */
- public java.util.List<java.lang.Integer>
- getPublicDependencyList() {
- return publicDependency_;
- }
- /**
- * <code>repeated int32 public_dependency = 10;</code>
- *
- * <pre>
- * Indexes of the public imported files in the dependency list above.
- * </pre>
- */
- public int getPublicDependencyCount() {
- return publicDependency_.size();
- }
- /**
- * <code>repeated int32 public_dependency = 10;</code>
- *
- * <pre>
- * Indexes of the public imported files in the dependency list above.
- * </pre>
- */
- public int getPublicDependency(int index) {
- return publicDependency_.get(index);
- }
-
- // repeated int32 weak_dependency = 11;
- public static final int WEAK_DEPENDENCY_FIELD_NUMBER = 11;
- private java.util.List<java.lang.Integer> weakDependency_;
- /**
- * <code>repeated int32 weak_dependency = 11;</code>
- *
- * <pre>
- * Indexes of the weak imported files in the dependency list.
- * For Google-internal migration only. Do not use.
- * </pre>
- */
- public java.util.List<java.lang.Integer>
- getWeakDependencyList() {
- return weakDependency_;
- }
- /**
- * <code>repeated int32 weak_dependency = 11;</code>
- *
- * <pre>
- * Indexes of the weak imported files in the dependency list.
- * For Google-internal migration only. Do not use.
- * </pre>
- */
- public int getWeakDependencyCount() {
- return weakDependency_.size();
- }
- /**
- * <code>repeated int32 weak_dependency = 11;</code>
- *
- * <pre>
- * Indexes of the weak imported files in the dependency list.
- * For Google-internal migration only. Do not use.
- * </pre>
- */
- public int getWeakDependency(int index) {
- return weakDependency_.get(index);
- }
-
- // repeated .google.protobuf.DescriptorProto message_type = 4;
- public static final int MESSAGE_TYPE_FIELD_NUMBER = 4;
- private java.util.List<org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto> messageType_;
- /**
- * <code>repeated .google.protobuf.DescriptorProto message_type = 4;</code>
- *
- * <pre>
- * All top-level definitions in this file.
- * </pre>
- */
- public java.util.List<org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto> getMessageTypeList() {
- return messageType_;
- }
- /**
- * <code>repeated .google.protobuf.DescriptorProto message_type = 4;</code>
- *
- * <pre>
- * All top-level definitions in this file.
- * </pre>
- */
- public java.util.List<? extends org.apache.pekko.protobuf.DescriptorProtos.DescriptorProtoOrBuilder>
- getMessageTypeOrBuilderList() {
- return messageType_;
- }
- /**
- * <code>repeated .google.protobuf.DescriptorProto message_type = 4;</code>
- *
- * <pre>
- * All top-level definitions in this file.
- * </pre>
- */
- public int getMessageTypeCount() {
- return messageType_.size();
- }
- /**
- * <code>repeated .google.protobuf.DescriptorProto message_type = 4;</code>
- *
- * <pre>
- * All top-level definitions in this file.
- * </pre>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto getMessageType(int index) {
- return messageType_.get(index);
- }
- /**
- * <code>repeated .google.protobuf.DescriptorProto message_type = 4;</code>
- *
- * <pre>
- * All top-level definitions in this file.
- * </pre>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.DescriptorProtoOrBuilder getMessageTypeOrBuilder(
- int index) {
- return messageType_.get(index);
- }
-
- // repeated .google.protobuf.EnumDescriptorProto enum_type = 5;
- public static final int ENUM_TYPE_FIELD_NUMBER = 5;
- private java.util.List<org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto> enumType_;
- /**
- * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 5;</code>
- */
- public java.util.List<org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto> getEnumTypeList() {
- return enumType_;
- }
- /**
- * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 5;</code>
- */
- public java.util.List<? extends org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProtoOrBuilder>
- getEnumTypeOrBuilderList() {
- return enumType_;
- }
- /**
- * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 5;</code>
- */
- public int getEnumTypeCount() {
- return enumType_.size();
- }
- /**
- * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 5;</code>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto getEnumType(int index) {
- return enumType_.get(index);
- }
- /**
- * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 5;</code>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProtoOrBuilder getEnumTypeOrBuilder(
- int index) {
- return enumType_.get(index);
- }
-
- // repeated .google.protobuf.ServiceDescriptorProto service = 6;
- public static final int SERVICE_FIELD_NUMBER = 6;
- private java.util.List<org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto> service_;
- /**
- * <code>repeated .google.protobuf.ServiceDescriptorProto service = 6;</code>
- */
- public java.util.List<org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto> getServiceList() {
- return service_;
- }
- /**
- * <code>repeated .google.protobuf.ServiceDescriptorProto service = 6;</code>
- */
- public java.util.List<? extends org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProtoOrBuilder>
- getServiceOrBuilderList() {
- return service_;
- }
- /**
- * <code>repeated .google.protobuf.ServiceDescriptorProto service = 6;</code>
- */
- public int getServiceCount() {
- return service_.size();
- }
- /**
- * <code>repeated .google.protobuf.ServiceDescriptorProto service = 6;</code>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto getService(int index) {
- return service_.get(index);
- }
- /**
- * <code>repeated .google.protobuf.ServiceDescriptorProto service = 6;</code>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProtoOrBuilder getServiceOrBuilder(
- int index) {
- return service_.get(index);
- }
-
- // repeated .google.protobuf.FieldDescriptorProto extension = 7;
- public static final int EXTENSION_FIELD_NUMBER = 7;
- private java.util.List<org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto> extension_;
- /**
- * <code>repeated .google.protobuf.FieldDescriptorProto extension = 7;</code>
- */
- public java.util.List<org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto> getExtensionList() {
- return extension_;
- }
- /**
- * <code>repeated .google.protobuf.FieldDescriptorProto extension = 7;</code>
- */
- public java.util.List<? extends org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProtoOrBuilder>
- getExtensionOrBuilderList() {
- return extension_;
- }
- /**
- * <code>repeated .google.protobuf.FieldDescriptorProto extension = 7;</code>
- */
- public int getExtensionCount() {
- return extension_.size();
- }
- /**
- * <code>repeated .google.protobuf.FieldDescriptorProto extension = 7;</code>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto getExtension(int index) {
- return extension_.get(index);
- }
- /**
- * <code>repeated .google.protobuf.FieldDescriptorProto extension = 7;</code>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProtoOrBuilder getExtensionOrBuilder(
- int index) {
- return extension_.get(index);
- }
-
- // optional .google.protobuf.FileOptions options = 8;
- public static final int OPTIONS_FIELD_NUMBER = 8;
- private org.apache.pekko.protobuf.DescriptorProtos.FileOptions options_;
- /**
- * <code>optional .google.protobuf.FileOptions options = 8;</code>
- */
- public boolean hasOptions() {
- return ((bitField0_ & 0x00000004) == 0x00000004);
- }
- /**
- * <code>optional .google.protobuf.FileOptions options = 8;</code>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.FileOptions getOptions() {
- return options_;
- }
- /**
- * <code>optional .google.protobuf.FileOptions options = 8;</code>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.FileOptionsOrBuilder getOptionsOrBuilder() {
- return options_;
- }
-
- // optional .google.protobuf.SourceCodeInfo source_code_info = 9;
- public static final int SOURCE_CODE_INFO_FIELD_NUMBER = 9;
- private org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo sourceCodeInfo_;
- /**
- * <code>optional .google.protobuf.SourceCodeInfo source_code_info = 9;</code>
- *
- * <pre>
- * This field contains optional information about the original source code.
- * You may safely remove this entire field whithout harming runtime
- * functionality of the descriptors -- the information is needed only by
- * development tools.
- * </pre>
- */
- public boolean hasSourceCodeInfo() {
- return ((bitField0_ & 0x00000008) == 0x00000008);
- }
- /**
- * <code>optional .google.protobuf.SourceCodeInfo source_code_info = 9;</code>
- *
- * <pre>
- * This field contains optional information about the original source code.
- * You may safely remove this entire field whithout harming runtime
- * functionality of the descriptors -- the information is needed only by
- * development tools.
- * </pre>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo getSourceCodeInfo() {
- return sourceCodeInfo_;
- }
- /**
- * <code>optional .google.protobuf.SourceCodeInfo source_code_info = 9;</code>
- *
- * <pre>
- * This field contains optional information about the original source code.
- * You may safely remove this entire field whithout harming runtime
- * functionality of the descriptors -- the information is needed only by
- * development tools.
- * </pre>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfoOrBuilder getSourceCodeInfoOrBuilder() {
- return sourceCodeInfo_;
- }
-
- private void initFields() {
- name_ = "";
- package_ = "";
- dependency_ = org.apache.pekko.protobuf.LazyStringArrayList.EMPTY;
- publicDependency_ = java.util.Collections.emptyList();
- weakDependency_ = java.util.Collections.emptyList();
- messageType_ = java.util.Collections.emptyList();
- enumType_ = java.util.Collections.emptyList();
- service_ = java.util.Collections.emptyList();
- extension_ = java.util.Collections.emptyList();
- options_ = org.apache.pekko.protobuf.DescriptorProtos.FileOptions.getDefaultInstance();
- sourceCodeInfo_ = org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo.getDefaultInstance();
- }
- private byte memoizedIsInitialized = -1;
- public final boolean isInitialized() {
- byte isInitialized = memoizedIsInitialized;
- if (isInitialized != -1) return isInitialized == 1;
-
- for (int i = 0; i < getMessageTypeCount(); i++) {
- if (!getMessageType(i).isInitialized()) {
- memoizedIsInitialized = 0;
- return false;
- }
- }
- for (int i = 0; i < getEnumTypeCount(); i++) {
- if (!getEnumType(i).isInitialized()) {
- memoizedIsInitialized = 0;
- return false;
- }
- }
- for (int i = 0; i < getServiceCount(); i++) {
- if (!getService(i).isInitialized()) {
- memoizedIsInitialized = 0;
- return false;
- }
- }
- for (int i = 0; i < getExtensionCount(); i++) {
- if (!getExtension(i).isInitialized()) {
- memoizedIsInitialized = 0;
- return false;
- }
- }
- if (hasOptions()) {
- if (!getOptions().isInitialized()) {
- memoizedIsInitialized = 0;
- return false;
- }
- }
- memoizedIsInitialized = 1;
- return true;
- }
-
- public void writeTo(org.apache.pekko.protobuf.CodedOutputStream output)
- throws java.io.IOException {
- getSerializedSize();
- if (((bitField0_ & 0x00000001) == 0x00000001)) {
- output.writeBytes(1, getNameBytes());
- }
- if (((bitField0_ & 0x00000002) == 0x00000002)) {
- output.writeBytes(2, getPackageBytes());
- }
- for (int i = 0; i < dependency_.size(); i++) {
- output.writeBytes(3, dependency_.getByteString(i));
- }
- for (int i = 0; i < messageType_.size(); i++) {
- output.writeMessage(4, messageType_.get(i));
- }
- for (int i = 0; i < enumType_.size(); i++) {
- output.writeMessage(5, enumType_.get(i));
- }
- for (int i = 0; i < service_.size(); i++) {
- output.writeMessage(6, service_.get(i));
- }
- for (int i = 0; i < extension_.size(); i++) {
- output.writeMessage(7, extension_.get(i));
- }
- if (((bitField0_ & 0x00000004) == 0x00000004)) {
- output.writeMessage(8, options_);
- }
- if (((bitField0_ & 0x00000008) == 0x00000008)) {
- output.writeMessage(9, sourceCodeInfo_);
- }
- for (int i = 0; i < publicDependency_.size(); i++) {
- output.writeInt32(10, publicDependency_.get(i));
- }
- for (int i = 0; i < weakDependency_.size(); i++) {
- output.writeInt32(11, weakDependency_.get(i));
- }
- getUnknownFields().writeTo(output);
- }
-
- private int memoizedSerializedSize = -1;
- public int getSerializedSize() {
- int size = memoizedSerializedSize;
- if (size != -1) return size;
-
- size = 0;
- if (((bitField0_ & 0x00000001) == 0x00000001)) {
- size += org.apache.pekko.protobuf.CodedOutputStream
- .computeBytesSize(1, getNameBytes());
- }
- if (((bitField0_ & 0x00000002) == 0x00000002)) {
- size += org.apache.pekko.protobuf.CodedOutputStream
- .computeBytesSize(2, getPackageBytes());
- }
- {
- int dataSize = 0;
- for (int i = 0; i < dependency_.size(); i++) {
- dataSize += org.apache.pekko.protobuf.CodedOutputStream
- .computeBytesSizeNoTag(dependency_.getByteString(i));
- }
- size += dataSize;
- size += 1 * getDependencyList().size();
- }
- for (int i = 0; i < messageType_.size(); i++) {
- size += org.apache.pekko.protobuf.CodedOutputStream
- .computeMessageSize(4, messageType_.get(i));
- }
- for (int i = 0; i < enumType_.size(); i++) {
- size += org.apache.pekko.protobuf.CodedOutputStream
- .computeMessageSize(5, enumType_.get(i));
- }
- for (int i = 0; i < service_.size(); i++) {
- size += org.apache.pekko.protobuf.CodedOutputStream
- .computeMessageSize(6, service_.get(i));
- }
- for (int i = 0; i < extension_.size(); i++) {
- size += org.apache.pekko.protobuf.CodedOutputStream
- .computeMessageSize(7, extension_.get(i));
- }
- if (((bitField0_ & 0x00000004) == 0x00000004)) {
- size += org.apache.pekko.protobuf.CodedOutputStream
- .computeMessageSize(8, options_);
- }
- if (((bitField0_ & 0x00000008) == 0x00000008)) {
- size += org.apache.pekko.protobuf.CodedOutputStream
- .computeMessageSize(9, sourceCodeInfo_);
- }
- {
- int dataSize = 0;
- for (int i = 0; i < publicDependency_.size(); i++) {
- dataSize += org.apache.pekko.protobuf.CodedOutputStream
- .computeInt32SizeNoTag(publicDependency_.get(i));
- }
- size += dataSize;
- size += 1 * getPublicDependencyList().size();
- }
- {
- int dataSize = 0;
- for (int i = 0; i < weakDependency_.size(); i++) {
- dataSize += org.apache.pekko.protobuf.CodedOutputStream
- .computeInt32SizeNoTag(weakDependency_.get(i));
- }
- size += dataSize;
- size += 1 * getWeakDependencyList().size();
- }
- size += getUnknownFields().getSerializedSize();
- memoizedSerializedSize = size;
- return size;
- }
-
- private static final long serialVersionUID = 0L;
- @java.lang.Override
- protected java.lang.Object writeReplace()
- throws java.io.ObjectStreamException {
- return super.writeReplace();
- }
-
- public static org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto parseFrom(
- org.apache.pekko.protobuf.ByteString data)
- throws org.apache.pekko.protobuf.InvalidProtocolBufferException {
- return PARSER.parseFrom(data);
- }
- public static org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto parseFrom(
- org.apache.pekko.protobuf.ByteString data,
- org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry)
- throws org.apache.pekko.protobuf.InvalidProtocolBufferException {
- return PARSER.parseFrom(data, extensionRegistry);
- }
- public static org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto parseFrom(byte[] data)
- throws org.apache.pekko.protobuf.InvalidProtocolBufferException {
- return PARSER.parseFrom(data);
- }
- public static org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto parseFrom(
- byte[] data,
- org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry)
- throws org.apache.pekko.protobuf.InvalidProtocolBufferException {
- return PARSER.parseFrom(data, extensionRegistry);
- }
- public static org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto parseFrom(java.io.InputStream input)
- throws java.io.IOException {
- return PARSER.parseFrom(input);
- }
- public static org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto parseFrom(
- java.io.InputStream input,
- org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry)
- throws java.io.IOException {
- return PARSER.parseFrom(input, extensionRegistry);
- }
- public static org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto parseDelimitedFrom(java.io.InputStream input)
- throws java.io.IOException {
- return PARSER.parseDelimitedFrom(input);
- }
- public static org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto parseDelimitedFrom(
- java.io.InputStream input,
- org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry)
- throws java.io.IOException {
- return PARSER.parseDelimitedFrom(input, extensionRegistry);
- }
- public static org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto parseFrom(
- org.apache.pekko.protobuf.CodedInputStream input)
- throws java.io.IOException {
- return PARSER.parseFrom(input);
- }
- public static org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto parseFrom(
- org.apache.pekko.protobuf.CodedInputStream input,
- org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry)
- throws java.io.IOException {
- return PARSER.parseFrom(input, extensionRegistry);
- }
-
- public static Builder newBuilder() { return Builder.create(); }
- public Builder newBuilderForType() { return newBuilder(); }
- public static Builder newBuilder(org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto prototype) {
- return newBuilder().mergeFrom(prototype);
- }
- public Builder toBuilder() { return newBuilder(this); }
-
- @java.lang.Override
- protected Builder newBuilderForType(
- org.apache.pekko.protobuf.GeneratedMessage.BuilderParent parent) {
- Builder builder = new Builder(parent);
- return builder;
- }
- /**
- * Protobuf type {@code google.protobuf.FileDescriptorProto}
- *
- * <pre>
- * Describes a complete .proto file.
- * </pre>
- */
- public static final class Builder extends
- org.apache.pekko.protobuf.GeneratedMessage.Builder<Builder>
- implements org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProtoOrBuilder {
- public static final org.apache.pekko.protobuf.Descriptors.Descriptor
- getDescriptor() {
- return org.apache.pekko.protobuf.DescriptorProtos.internal_static_google_protobuf_FileDescriptorProto_descriptor;
- }
-
- protected org.apache.pekko.protobuf.GeneratedMessage.FieldAccessorTable
- internalGetFieldAccessorTable() {
- return org.apache.pekko.protobuf.DescriptorProtos.internal_static_google_protobuf_FileDescriptorProto_fieldAccessorTable
- .ensureFieldAccessorsInitialized(
- org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto.class, org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto.Builder.class);
- }
-
- // Construct using org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto.newBuilder()
- private Builder() {
- maybeForceBuilderInitialization();
- }
-
- private Builder(
- org.apache.pekko.protobuf.GeneratedMessage.BuilderParent parent) {
- super(parent);
- maybeForceBuilderInitialization();
- }
- private void maybeForceBuilderInitialization() {
- if (org.apache.pekko.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
- getMessageTypeFieldBuilder();
- getEnumTypeFieldBuilder();
- getServiceFieldBuilder();
- getExtensionFieldBuilder();
- getOptionsFieldBuilder();
- getSourceCodeInfoFieldBuilder();
- }
- }
- private static Builder create() {
- return new Builder();
- }
-
- public Builder clear() {
- super.clear();
- name_ = "";
- bitField0_ = (bitField0_ & ~0x00000001);
- package_ = "";
- bitField0_ = (bitField0_ & ~0x00000002);
- dependency_ = org.apache.pekko.protobuf.LazyStringArrayList.EMPTY;
- bitField0_ = (bitField0_ & ~0x00000004);
- publicDependency_ = java.util.Collections.emptyList();
- bitField0_ = (bitField0_ & ~0x00000008);
- weakDependency_ = java.util.Collections.emptyList();
- bitField0_ = (bitField0_ & ~0x00000010);
- if (messageTypeBuilder_ == null) {
- messageType_ = java.util.Collections.emptyList();
- bitField0_ = (bitField0_ & ~0x00000020);
- } else {
- messageTypeBuilder_.clear();
- }
- if (enumTypeBuilder_ == null) {
- enumType_ = java.util.Collections.emptyList();
- bitField0_ = (bitField0_ & ~0x00000040);
- } else {
- enumTypeBuilder_.clear();
- }
- if (serviceBuilder_ == null) {
- service_ = java.util.Collections.emptyList();
- bitField0_ = (bitField0_ & ~0x00000080);
- } else {
- serviceBuilder_.clear();
- }
- if (extensionBuilder_ == null) {
- extension_ = java.util.Collections.emptyList();
- bitField0_ = (bitField0_ & ~0x00000100);
- } else {
- extensionBuilder_.clear();
- }
- if (optionsBuilder_ == null) {
- options_ = org.apache.pekko.protobuf.DescriptorProtos.FileOptions.getDefaultInstance();
- } else {
- optionsBuilder_.clear();
- }
- bitField0_ = (bitField0_ & ~0x00000200);
- if (sourceCodeInfoBuilder_ == null) {
- sourceCodeInfo_ = org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo.getDefaultInstance();
- } else {
- sourceCodeInfoBuilder_.clear();
- }
- bitField0_ = (bitField0_ & ~0x00000400);
- return this;
- }
-
- public Builder clone() {
- return create().mergeFrom(buildPartial());
- }
-
- public org.apache.pekko.protobuf.Descriptors.Descriptor
- getDescriptorForType() {
- return org.apache.pekko.protobuf.DescriptorProtos.internal_static_google_protobuf_FileDescriptorProto_descriptor;
- }
-
- public org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto getDefaultInstanceForType() {
- return org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto.getDefaultInstance();
- }
-
- public org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto build() {
- org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto result = buildPartial();
- if (!result.isInitialized()) {
- throw newUninitializedMessageException(result);
- }
- return result;
- }
-
- public org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto buildPartial() {
- org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto result = new org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto(this);
- int from_bitField0_ = bitField0_;
- int to_bitField0_ = 0;
- if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
- to_bitField0_ |= 0x00000001;
- }
- result.name_ = name_;
- if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
- to_bitField0_ |= 0x00000002;
- }
- result.package_ = package_;
- if (((bitField0_ & 0x00000004) == 0x00000004)) {
- dependency_ = new org.apache.pekko.protobuf.UnmodifiableLazyStringList(
- dependency_);
- bitField0_ = (bitField0_ & ~0x00000004);
- }
- result.dependency_ = dependency_;
- if (((bitField0_ & 0x00000008) == 0x00000008)) {
- publicDependency_ = java.util.Collections.unmodifiableList(publicDependency_);
- bitField0_ = (bitField0_ & ~0x00000008);
- }
- result.publicDependency_ = publicDependency_;
- if (((bitField0_ & 0x00000010) == 0x00000010)) {
- weakDependency_ = java.util.Collections.unmodifiableList(weakDependency_);
- bitField0_ = (bitField0_ & ~0x00000010);
- }
- result.weakDependency_ = weakDependency_;
- if (messageTypeBuilder_ == null) {
- if (((bitField0_ & 0x00000020) == 0x00000020)) {
- messageType_ = java.util.Collections.unmodifiableList(messageType_);
- bitField0_ = (bitField0_ & ~0x00000020);
- }
- result.messageType_ = messageType_;
- } else {
- result.messageType_ = messageTypeBuilder_.build();
- }
- if (enumTypeBuilder_ == null) {
- if (((bitField0_ & 0x00000040) == 0x00000040)) {
- enumType_ = java.util.Collections.unmodifiableList(enumType_);
- bitField0_ = (bitField0_ & ~0x00000040);
- }
- result.enumType_ = enumType_;
- } else {
- result.enumType_ = enumTypeBuilder_.build();
- }
- if (serviceBuilder_ == null) {
- if (((bitField0_ & 0x00000080) == 0x00000080)) {
- service_ = java.util.Collections.unmodifiableList(service_);
- bitField0_ = (bitField0_ & ~0x00000080);
- }
- result.service_ = service_;
- } else {
- result.service_ = serviceBuilder_.build();
- }
- if (extensionBuilder_ == null) {
- if (((bitField0_ & 0x00000100) == 0x00000100)) {
- extension_ = java.util.Collections.unmodifiableList(extension_);
- bitField0_ = (bitField0_ & ~0x00000100);
- }
- result.extension_ = extension_;
- } else {
- result.extension_ = extensionBuilder_.build();
- }
- if (((from_bitField0_ & 0x00000200) == 0x00000200)) {
- to_bitField0_ |= 0x00000004;
- }
- if (optionsBuilder_ == null) {
- result.options_ = options_;
- } else {
- result.options_ = optionsBuilder_.build();
- }
- if (((from_bitField0_ & 0x00000400) == 0x00000400)) {
- to_bitField0_ |= 0x00000008;
- }
- if (sourceCodeInfoBuilder_ == null) {
- result.sourceCodeInfo_ = sourceCodeInfo_;
- } else {
- result.sourceCodeInfo_ = sourceCodeInfoBuilder_.build();
- }
- result.bitField0_ = to_bitField0_;
- onBuilt();
- return result;
- }
-
- public Builder mergeFrom(org.apache.pekko.protobuf.Message other) {
- if (other instanceof org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto) {
- return mergeFrom((org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto)other);
- } else {
- super.mergeFrom(other);
- return this;
- }
- }
-
- public Builder mergeFrom(org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto other) {
- if (other == org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto.getDefaultInstance()) return this;
- if (other.hasName()) {
- bitField0_ |= 0x00000001;
- name_ = other.name_;
- onChanged();
- }
- if (other.hasPackage()) {
- bitField0_ |= 0x00000002;
- package_ = other.package_;
- onChanged();
- }
- if (!other.dependency_.isEmpty()) {
- if (dependency_.isEmpty()) {
- dependency_ = other.dependency_;
- bitField0_ = (bitField0_ & ~0x00000004);
- } else {
- ensureDependencyIsMutable();
- dependency_.addAll(other.dependency_);
- }
- onChanged();
- }
- if (!other.publicDependency_.isEmpty()) {
- if (publicDependency_.isEmpty()) {
- publicDependency_ = other.publicDependency_;
- bitField0_ = (bitField0_ & ~0x00000008);
- } else {
- ensurePublicDependencyIsMutable();
- publicDependency_.addAll(other.publicDependency_);
- }
- onChanged();
- }
- if (!other.weakDependency_.isEmpty()) {
- if (weakDependency_.isEmpty()) {
- weakDependency_ = other.weakDependency_;
- bitField0_ = (bitField0_ & ~0x00000010);
- } else {
- ensureWeakDependencyIsMutable();
- weakDependency_.addAll(other.weakDependency_);
- }
- onChanged();
- }
- if (messageTypeBuilder_ == null) {
- if (!other.messageType_.isEmpty()) {
- if (messageType_.isEmpty()) {
- messageType_ = other.messageType_;
- bitField0_ = (bitField0_ & ~0x00000020);
- } else {
- ensureMessageTypeIsMutable();
- messageType_.addAll(other.messageType_);
- }
- onChanged();
- }
- } else {
- if (!other.messageType_.isEmpty()) {
- if (messageTypeBuilder_.isEmpty()) {
- messageTypeBuilder_.dispose();
- messageTypeBuilder_ = null;
- messageType_ = other.messageType_;
- bitField0_ = (bitField0_ & ~0x00000020);
- messageTypeBuilder_ =
- org.apache.pekko.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
- getMessageTypeFieldBuilder() : null;
- } else {
- messageTypeBuilder_.addAllMessages(other.messageType_);
- }
- }
- }
- if (enumTypeBuilder_ == null) {
- if (!other.enumType_.isEmpty()) {
- if (enumType_.isEmpty()) {
- enumType_ = other.enumType_;
- bitField0_ = (bitField0_ & ~0x00000040);
- } else {
- ensureEnumTypeIsMutable();
- enumType_.addAll(other.enumType_);
- }
- onChanged();
- }
- } else {
- if (!other.enumType_.isEmpty()) {
- if (enumTypeBuilder_.isEmpty()) {
- enumTypeBuilder_.dispose();
- enumTypeBuilder_ = null;
- enumType_ = other.enumType_;
- bitField0_ = (bitField0_ & ~0x00000040);
- enumTypeBuilder_ =
- org.apache.pekko.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
- getEnumTypeFieldBuilder() : null;
- } else {
- enumTypeBuilder_.addAllMessages(other.enumType_);
- }
- }
- }
- if (serviceBuilder_ == null) {
- if (!other.service_.isEmpty()) {
- if (service_.isEmpty()) {
- service_ = other.service_;
- bitField0_ = (bitField0_ & ~0x00000080);
- } else {
- ensureServiceIsMutable();
- service_.addAll(other.service_);
- }
- onChanged();
- }
- } else {
- if (!other.service_.isEmpty()) {
- if (serviceBuilder_.isEmpty()) {
- serviceBuilder_.dispose();
- serviceBuilder_ = null;
- service_ = other.service_;
- bitField0_ = (bitField0_ & ~0x00000080);
- serviceBuilder_ =
- org.apache.pekko.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
- getServiceFieldBuilder() : null;
- } else {
- serviceBuilder_.addAllMessages(other.service_);
- }
- }
- }
- if (extensionBuilder_ == null) {
- if (!other.extension_.isEmpty()) {
- if (extension_.isEmpty()) {
- extension_ = other.extension_;
- bitField0_ = (bitField0_ & ~0x00000100);
- } else {
- ensureExtensionIsMutable();
- extension_.addAll(other.extension_);
- }
- onChanged();
- }
- } else {
- if (!other.extension_.isEmpty()) {
- if (extensionBuilder_.isEmpty()) {
- extensionBuilder_.dispose();
- extensionBuilder_ = null;
- extension_ = other.extension_;
- bitField0_ = (bitField0_ & ~0x00000100);
- extensionBuilder_ =
- org.apache.pekko.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
- getExtensionFieldBuilder() : null;
- } else {
- extensionBuilder_.addAllMessages(other.extension_);
- }
- }
- }
- if (other.hasOptions()) {
- mergeOptions(other.getOptions());
- }
- if (other.hasSourceCodeInfo()) {
- mergeSourceCodeInfo(other.getSourceCodeInfo());
- }
- this.mergeUnknownFields(other.getUnknownFields());
- return this;
- }
-
- public final boolean isInitialized() {
- for (int i = 0; i < getMessageTypeCount(); i++) {
- if (!getMessageType(i).isInitialized()) {
-
- return false;
- }
- }
- for (int i = 0; i < getEnumTypeCount(); i++) {
- if (!getEnumType(i).isInitialized()) {
-
- return false;
- }
- }
- for (int i = 0; i < getServiceCount(); i++) {
- if (!getService(i).isInitialized()) {
-
- return false;
- }
- }
- for (int i = 0; i < getExtensionCount(); i++) {
- if (!getExtension(i).isInitialized()) {
-
- return false;
- }
- }
- if (hasOptions()) {
- if (!getOptions().isInitialized()) {
-
- return false;
- }
- }
- return true;
- }
-
- public Builder mergeFrom(
- org.apache.pekko.protobuf.CodedInputStream input,
- org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry)
- throws java.io.IOException {
- org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto parsedMessage = null;
- try {
- parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
- } catch (org.apache.pekko.protobuf.InvalidProtocolBufferException e) {
- parsedMessage = (org.apache.pekko.protobuf.DescriptorProtos.FileDescriptorProto) e.getUnfinishedMessage();
- throw e;
- } finally {
- if (parsedMessage != null) {
- mergeFrom(parsedMessage);
- }
- }
- return this;
- }
- private int bitField0_;
-
- // optional string name = 1;
- private java.lang.Object name_ = "";
- /**
- * <code>optional string name = 1;</code>
- *
- * <pre>
- * file name, relative to root of source tree
- * </pre>
- */
- public boolean hasName() {
- return ((bitField0_ & 0x00000001) == 0x00000001);
- }
- /**
- * <code>optional string name = 1;</code>
- *
- * <pre>
- * file name, relative to root of source tree
- * </pre>
- */
- public java.lang.String getName() {
- java.lang.Object ref = name_;
- if (!(ref instanceof java.lang.String)) {
- java.lang.String s = ((org.apache.pekko.protobuf.ByteString) ref)
- .toStringUtf8();
- name_ = s;
- return s;
- } else {
- return (java.lang.String) ref;
- }
- }
- /**
- * <code>optional string name = 1;</code>
- *
- * <pre>
- * file name, relative to root of source tree
- * </pre>
- */
- public org.apache.pekko.protobuf.ByteString
- getNameBytes() {
- java.lang.Object ref = name_;
- if (ref instanceof String) {
- org.apache.pekko.protobuf.ByteString b =
- org.apache.pekko.protobuf.ByteString.copyFromUtf8(
- (java.lang.String) ref);
- name_ = b;
- return b;
- } else {
- return (org.apache.pekko.protobuf.ByteString) ref;
- }
- }
- /**
- * <code>optional string name = 1;</code>
- *
- * <pre>
- * file name, relative to root of source tree
- * </pre>
- */
- public Builder setName(
- java.lang.String value) {
- if (value == null) {
- throw new NullPointerException();
- }
- bitField0_ |= 0x00000001;
- name_ = value;
- onChanged();
- return this;
- }
- /**
- * <code>optional string name = 1;</code>
- *
- * <pre>
- * file name, relative to root of source tree
- * </pre>
- */
- public Builder clearName() {
- bitField0_ = (bitField0_ & ~0x00000001);
- name_ = getDefaultInstance().getName();
- onChanged();
- return this;
- }
- /**
- * <code>optional string name = 1;</code>
- *
- * <pre>
- * file name, relative to root of source tree
- * </pre>
- */
- public Builder setNameBytes(
- org.apache.pekko.protobuf.ByteString value) {
- if (value == null) {
- throw new NullPointerException();
- }
- bitField0_ |= 0x00000001;
- name_ = value;
- onChanged();
- return this;
- }
-
- // optional string package = 2;
- private java.lang.Object package_ = "";
- /**
- * <code>optional string package = 2;</code>
- *
- * <pre>
- * e.g. "foo", "foo.bar", etc.
- * </pre>
- */
- public boolean hasPackage() {
- return ((bitField0_ & 0x00000002) == 0x00000002);
- }
- /**
- * <code>optional string package = 2;</code>
- *
- * <pre>
- * e.g. "foo", "foo.bar", etc.
- * </pre>
- */
- public java.lang.String getPackage() {
- java.lang.Object ref = package_;
- if (!(ref instanceof java.lang.String)) {
- java.lang.String s = ((org.apache.pekko.protobuf.ByteString) ref)
- .toStringUtf8();
- package_ = s;
- return s;
- } else {
- return (java.lang.String) ref;
- }
- }
- /**
- * <code>optional string package = 2;</code>
- *
- * <pre>
- * e.g. "foo", "foo.bar", etc.
- * </pre>
- */
- public org.apache.pekko.protobuf.ByteString
- getPackageBytes() {
- java.lang.Object ref = package_;
- if (ref instanceof String) {
- org.apache.pekko.protobuf.ByteString b =
- org.apache.pekko.protobuf.ByteString.copyFromUtf8(
- (java.lang.String) ref);
- package_ = b;
- return b;
- } else {
- return (org.apache.pekko.protobuf.ByteString) ref;
- }
- }
- /**
- * <code>optional string package = 2;</code>
- *
- * <pre>
- * e.g. "foo", "foo.bar", etc.
- * </pre>
- */
- public Builder setPackage(
- java.lang.String value) {
- if (value == null) {
- throw new NullPointerException();
- }
- bitField0_ |= 0x00000002;
- package_ = value;
- onChanged();
- return this;
- }
- /**
- * <code>optional string package = 2;</code>
- *
- * <pre>
- * e.g. "foo", "foo.bar", etc.
- * </pre>
- */
- public Builder clearPackage() {
- bitField0_ = (bitField0_ & ~0x00000002);
- package_ = getDefaultInstance().getPackage();
- onChanged();
- return this;
- }
- /**
- * <code>optional string package = 2;</code>
- *
- * <pre>
- * e.g. "foo", "foo.bar", etc.
- * </pre>
- */
- public Builder setPackageBytes(
- org.apache.pekko.protobuf.ByteString value) {
- if (value == null) {
- throw new NullPointerException();
- }
- bitField0_ |= 0x00000002;
- package_ = value;
- onChanged();
- return this;
- }
-
- // repeated string dependency = 3;
- private org.apache.pekko.protobuf.LazyStringList dependency_ = org.apache.pekko.protobuf.LazyStringArrayList.EMPTY;
- private void ensureDependencyIsMutable() {
- if (!((bitField0_ & 0x00000004) == 0x00000004)) {
- dependency_ = new org.apache.pekko.protobuf.LazyStringArrayList(dependency_);
- bitField0_ |= 0x00000004;
- }
- }
- /**
- * <code>repeated string dependency = 3;</code>
- *
- * <pre>
- * Names of files imported by this file.
- * </pre>
- */
- public java.util.List<java.lang.String>
- getDependencyList() {
- return java.util.Collections.unmodifiableList(dependency_);
- }
- /**
- * <code>repeated string dependency = 3;</code>
- *
- * <pre>
- * Names of files imported by this file.
- * </pre>
- */
- public int getDependencyCount() {
- return dependency_.size();
- }
- /**
- * <code>repeated string dependency = 3;</code>
- *
- * <pre>
- * Names of files imported by this file.
- * </pre>
- */
- public java.lang.String getDependency(int index) {
- return dependency_.get(index);
- }
- /**
- * <code>repeated string dependency = 3;</code>
- *
- * <pre>
- * Names of files imported by this file.
- * </pre>
- */
- public org.apache.pekko.protobuf.ByteString
- getDependencyBytes(int index) {
- return dependency_.getByteString(index);
- }
- /**
- * <code>repeated string dependency = 3;</code>
- *
- * <pre>
- * Names of files imported by this file.
- * </pre>
- */
- public Builder setDependency(
- int index, java.lang.String value) {
- if (value == null) {
- throw new NullPointerException();
- }
- ensureDependencyIsMutable();
- dependency_.set(index, value);
- onChanged();
- return this;
- }
- /**
- * <code>repeated string dependency = 3;</code>
- *
- * <pre>
- * Names of files imported by this file.
- * </pre>
- */
- public Builder addDependency(
- java.lang.String value) {
- if (value == null) {
- throw new NullPointerException();
- }
- ensureDependencyIsMutable();
- dependency_.add(value);
- onChanged();
- return this;
- }
- /**
- * <code>repeated string dependency = 3;</code>
- *
- * <pre>
- * Names of files imported by this file.
- * </pre>
- */
- public Builder addAllDependency(
- java.lang.Iterable<java.lang.String> values) {
- ensureDependencyIsMutable();
- super.addAll(values, dependency_);
- onChanged();
- return this;
- }
- /**
- * <code>repeated string dependency = 3;</code>
- *
- * <pre>
- * Names of files imported by this file.
- * </pre>
- */
- public Builder clearDependency() {
- dependency_ = org.apache.pekko.protobuf.LazyStringArrayList.EMPTY;
- bitField0_ = (bitField0_ & ~0x00000004);
- onChanged();
- return this;
- }
- /**
- * <code>repeated string dependency = 3;</code>
- *
- * <pre>
- * Names of files imported by this file.
- * </pre>
- */
- public Builder addDependencyBytes(
- org.apache.pekko.protobuf.ByteString value) {
- if (value == null) {
- throw new NullPointerException();
- }
- ensureDependencyIsMutable();
- dependency_.add(value);
- onChanged();
- return this;
- }
-
- // repeated int32 public_dependency = 10;
- private java.util.List<java.lang.Integer> publicDependency_ = java.util.Collections.emptyList();
- private void ensurePublicDependencyIsMutable() {
- if (!((bitField0_ & 0x00000008) == 0x00000008)) {
- publicDependency_ = new java.util.ArrayList<java.lang.Integer>(publicDependency_);
- bitField0_ |= 0x00000008;
- }
- }
- /**
- * <code>repeated int32 public_dependency = 10;</code>
- *
- * <pre>
- * Indexes of the public imported files in the dependency list above.
- * </pre>
- */
- public java.util.List<java.lang.Integer>
- getPublicDependencyList() {
- return java.util.Collections.unmodifiableList(publicDependency_);
- }
- /**
- * <code>repeated int32 public_dependency = 10;</code>
- *
- * <pre>
- * Indexes of the public imported files in the dependency list above.
- * </pre>
- */
- public int getPublicDependencyCount() {
- return publicDependency_.size();
- }
- /**
- * <code>repeated int32 public_dependency = 10;</code>
- *
- * <pre>
- * Indexes of the public imported files in the dependency list above.
- * </pre>
- */
- public int getPublicDependency(int index) {
- return publicDependency_.get(index);
- }
- /**
- * <code>repeated int32 public_dependency = 10;</code>
- *
- * <pre>
- * Indexes of the public imported files in the dependency list above.
- * </pre>
- */
- public Builder setPublicDependency(
- int index, int value) {
- ensurePublicDependencyIsMutable();
- publicDependency_.set(index, value);
- onChanged();
- return this;
- }
- /**
- * <code>repeated int32 public_dependency = 10;</code>
- *
- * <pre>
- * Indexes of the public imported files in the dependency list above.
- * </pre>
- */
- public Builder addPublicDependency(int value) {
- ensurePublicDependencyIsMutable();
- publicDependency_.add(value);
- onChanged();
- return this;
- }
- /**
- * <code>repeated int32 public_dependency = 10;</code>
- *
- * <pre>
- * Indexes of the public imported files in the dependency list above.
- * </pre>
- */
- public Builder addAllPublicDependency(
- java.lang.Iterable<? extends java.lang.Integer> values) {
- ensurePublicDependencyIsMutable();
- super.addAll(values, publicDependency_);
- onChanged();
- return this;
- }
- /**
- * <code>repeated int32 public_dependency = 10;</code>
- *
- * <pre>
- * Indexes of the public imported files in the dependency list above.
- * </pre>
- */
- public Builder clearPublicDependency() {
- publicDependency_ = java.util.Collections.emptyList();
- bitField0_ = (bitField0_ & ~0x00000008);
- onChanged();
- return this;
- }
-
- // repeated int32 weak_dependency = 11;
- private java.util.List<java.lang.Integer> weakDependency_ = java.util.Collections.emptyList();
- private void ensureWeakDependencyIsMutable() {
- if (!((bitField0_ & 0x00000010) == 0x00000010)) {
- weakDependency_ = new java.util.ArrayList<java.lang.Integer>(weakDependency_);
- bitField0_ |= 0x00000010;
- }
- }
- /**
- * <code>repeated int32 weak_dependency = 11;</code>
- *
- * <pre>
- * Indexes of the weak imported files in the dependency list.
- * For Google-internal migration only. Do not use.
- * </pre>
- */
- public java.util.List<java.lang.Integer>
- getWeakDependencyList() {
- return java.util.Collections.unmodifiableList(weakDependency_);
- }
- /**
- * <code>repeated int32 weak_dependency = 11;</code>
- *
- * <pre>
- * Indexes of the weak imported files in the dependency list.
- * For Google-internal migration only. Do not use.
- * </pre>
- */
- public int getWeakDependencyCount() {
- return weakDependency_.size();
- }
- /**
- * <code>repeated int32 weak_dependency = 11;</code>
- *
- * <pre>
- * Indexes of the weak imported files in the dependency list.
- * For Google-internal migration only. Do not use.
- * </pre>
- */
- public int getWeakDependency(int index) {
- return weakDependency_.get(index);
- }
- /**
- * <code>repeated int32 weak_dependency = 11;</code>
- *
- * <pre>
- * Indexes of the weak imported files in the dependency list.
- * For Google-internal migration only. Do not use.
- * </pre>
- */
- public Builder setWeakDependency(
- int index, int value) {
- ensureWeakDependencyIsMutable();
- weakDependency_.set(index, value);
- onChanged();
- return this;
- }
- /**
- * <code>repeated int32 weak_dependency = 11;</code>
- *
- * <pre>
- * Indexes of the weak imported files in the dependency list.
- * For Google-internal migration only. Do not use.
- * </pre>
- */
- public Builder addWeakDependency(int value) {
- ensureWeakDependencyIsMutable();
- weakDependency_.add(value);
- onChanged();
- return this;
- }
- /**
- * <code>repeated int32 weak_dependency = 11;</code>
- *
- * <pre>
- * Indexes of the weak imported files in the dependency list.
- * For Google-internal migration only. Do not use.
- * </pre>
- */
- public Builder addAllWeakDependency(
- java.lang.Iterable<? extends java.lang.Integer> values) {
- ensureWeakDependencyIsMutable();
- super.addAll(values, weakDependency_);
- onChanged();
- return this;
- }
- /**
- * <code>repeated int32 weak_dependency = 11;</code>
- *
- * <pre>
- * Indexes of the weak imported files in the dependency list.
- * For Google-internal migration only. Do not use.
- * </pre>
- */
- public Builder clearWeakDependency() {
- weakDependency_ = java.util.Collections.emptyList();
- bitField0_ = (bitField0_ & ~0x00000010);
- onChanged();
- return this;
- }
-
- // repeated .google.protobuf.DescriptorProto message_type = 4;
- private java.util.List<org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto> messageType_ =
- java.util.Collections.emptyList();
- private void ensureMessageTypeIsMutable() {
- if (!((bitField0_ & 0x00000020) == 0x00000020)) {
- messageType_ = new java.util.ArrayList<org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto>(messageType_);
- bitField0_ |= 0x00000020;
- }
- }
-
- private org.apache.pekko.protobuf.RepeatedFieldBuilder<
- org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProtoOrBuilder> messageTypeBuilder_;
-
- /**
- * <code>repeated .google.protobuf.DescriptorProto message_type = 4;</code>
- *
- * <pre>
- * All top-level definitions in this file.
- * </pre>
- */
- public java.util.List<org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto> getMessageTypeList() {
- if (messageTypeBuilder_ == null) {
- return java.util.Collections.unmodifiableList(messageType_);
- } else {
- return messageTypeBuilder_.getMessageList();
- }
- }
- /**
- * <code>repeated .google.protobuf.DescriptorProto message_type = 4;</code>
- *
- * <pre>
- * All top-level definitions in this file.
- * </pre>
- */
- public int getMessageTypeCount() {
- if (messageTypeBuilder_ == null) {
- return messageType_.size();
- } else {
- return messageTypeBuilder_.getCount();
- }
- }
- /**
- * <code>repeated .google.protobuf.DescriptorProto message_type = 4;</code>
- *
- * <pre>
- * All top-level definitions in this file.
- * </pre>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto getMessageType(int index) {
- if (messageTypeBuilder_ == null) {
- return messageType_.get(index);
- } else {
- return messageTypeBuilder_.getMessage(index);
- }
- }
- /**
- * <code>repeated .google.protobuf.DescriptorProto message_type = 4;</code>
- *
- * <pre>
- * All top-level definitions in this file.
- * </pre>
- */
- public Builder setMessageType(
- int index, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto value) {
- if (messageTypeBuilder_ == null) {
- if (value == null) {
- throw new NullPointerException();
- }
- ensureMessageTypeIsMutable();
- messageType_.set(index, value);
- onChanged();
- } else {
- messageTypeBuilder_.setMessage(index, value);
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.DescriptorProto message_type = 4;</code>
- *
- * <pre>
- * All top-level definitions in this file.
- * </pre>
- */
- public Builder setMessageType(
- int index, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.Builder builderForValue) {
- if (messageTypeBuilder_ == null) {
- ensureMessageTypeIsMutable();
- messageType_.set(index, builderForValue.build());
- onChanged();
- } else {
- messageTypeBuilder_.setMessage(index, builderForValue.build());
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.DescriptorProto message_type = 4;</code>
- *
- * <pre>
- * All top-level definitions in this file.
- * </pre>
- */
- public Builder addMessageType(org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto value) {
- if (messageTypeBuilder_ == null) {
- if (value == null) {
- throw new NullPointerException();
- }
- ensureMessageTypeIsMutable();
- messageType_.add(value);
- onChanged();
- } else {
- messageTypeBuilder_.addMessage(value);
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.DescriptorProto message_type = 4;</code>
- *
- * <pre>
- * All top-level definitions in this file.
- * </pre>
- */
- public Builder addMessageType(
- int index, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto value) {
- if (messageTypeBuilder_ == null) {
- if (value == null) {
- throw new NullPointerException();
- }
- ensureMessageTypeIsMutable();
- messageType_.add(index, value);
- onChanged();
- } else {
- messageTypeBuilder_.addMessage(index, value);
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.DescriptorProto message_type = 4;</code>
- *
- * <pre>
- * All top-level definitions in this file.
- * </pre>
- */
- public Builder addMessageType(
- org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.Builder builderForValue) {
- if (messageTypeBuilder_ == null) {
- ensureMessageTypeIsMutable();
- messageType_.add(builderForValue.build());
- onChanged();
- } else {
- messageTypeBuilder_.addMessage(builderForValue.build());
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.DescriptorProto message_type = 4;</code>
- *
- * <pre>
- * All top-level definitions in this file.
- * </pre>
- */
- public Builder addMessageType(
- int index, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.Builder builderForValue) {
- if (messageTypeBuilder_ == null) {
- ensureMessageTypeIsMutable();
- messageType_.add(index, builderForValue.build());
- onChanged();
- } else {
- messageTypeBuilder_.addMessage(index, builderForValue.build());
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.DescriptorProto message_type = 4;</code>
- *
- * <pre>
- * All top-level definitions in this file.
- * </pre>
- */
- public Builder addAllMessageType(
- java.lang.Iterable<? extends org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto> values) {
- if (messageTypeBuilder_ == null) {
- ensureMessageTypeIsMutable();
- super.addAll(values, messageType_);
- onChanged();
- } else {
- messageTypeBuilder_.addAllMessages(values);
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.DescriptorProto message_type = 4;</code>
- *
- * <pre>
- * All top-level definitions in this file.
- * </pre>
- */
- public Builder clearMessageType() {
- if (messageTypeBuilder_ == null) {
- messageType_ = java.util.Collections.emptyList();
- bitField0_ = (bitField0_ & ~0x00000020);
- onChanged();
- } else {
- messageTypeBuilder_.clear();
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.DescriptorProto message_type = 4;</code>
- *
- * <pre>
- * All top-level definitions in this file.
- * </pre>
- */
- public Builder removeMessageType(int index) {
- if (messageTypeBuilder_ == null) {
- ensureMessageTypeIsMutable();
- messageType_.remove(index);
- onChanged();
- } else {
- messageTypeBuilder_.remove(index);
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.DescriptorProto message_type = 4;</code>
- *
- * <pre>
- * All top-level definitions in this file.
- * </pre>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.Builder getMessageTypeBuilder(
- int index) {
- return getMessageTypeFieldBuilder().getBuilder(index);
- }
- /**
- * <code>repeated .google.protobuf.DescriptorProto message_type = 4;</code>
- *
- * <pre>
- * All top-level definitions in this file.
- * </pre>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.DescriptorProtoOrBuilder getMessageTypeOrBuilder(
- int index) {
- if (messageTypeBuilder_ == null) {
- return messageType_.get(index); } else {
- return messageTypeBuilder_.getMessageOrBuilder(index);
- }
- }
- /**
- * <code>repeated .google.protobuf.DescriptorProto message_type = 4;</code>
- *
- * <pre>
- * All top-level definitions in this file.
- * </pre>
- */
- public java.util.List<? extends org.apache.pekko.protobuf.DescriptorProtos.DescriptorProtoOrBuilder>
- getMessageTypeOrBuilderList() {
- if (messageTypeBuilder_ != null) {
- return messageTypeBuilder_.getMessageOrBuilderList();
- } else {
- return java.util.Collections.unmodifiableList(messageType_);
- }
- }
- /**
- * <code>repeated .google.protobuf.DescriptorProto message_type = 4;</code>
- *
- * <pre>
- * All top-level definitions in this file.
- * </pre>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.Builder addMessageTypeBuilder() {
- return getMessageTypeFieldBuilder().addBuilder(
- org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.getDefaultInstance());
- }
- /**
- * <code>repeated .google.protobuf.DescriptorProto message_type = 4;</code>
- *
- * <pre>
- * All top-level definitions in this file.
- * </pre>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.Builder addMessageTypeBuilder(
- int index) {
- return getMessageTypeFieldBuilder().addBuilder(
- index, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.getDefaultInstance());
- }
- /**
- * <code>repeated .google.protobuf.DescriptorProto message_type = 4;</code>
- *
- * <pre>
- * All top-level definitions in this file.
- * </pre>
- */
- public java.util.List<org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.Builder>
- getMessageTypeBuilderList() {
- return getMessageTypeFieldBuilder().getBuilderList();
- }
- private org.apache.pekko.protobuf.RepeatedFieldBuilder<
- org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProtoOrBuilder>
- getMessageTypeFieldBuilder() {
- if (messageTypeBuilder_ == null) {
- messageTypeBuilder_ = new org.apache.pekko.protobuf.RepeatedFieldBuilder<
- org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProtoOrBuilder>(
- messageType_,
- ((bitField0_ & 0x00000020) == 0x00000020),
- getParentForChildren(),
- isClean());
- messageType_ = null;
- }
- return messageTypeBuilder_;
- }
-
- // repeated .google.protobuf.EnumDescriptorProto enum_type = 5;
- private java.util.List<org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto> enumType_ =
- java.util.Collections.emptyList();
- private void ensureEnumTypeIsMutable() {
- if (!((bitField0_ & 0x00000040) == 0x00000040)) {
- enumType_ = new java.util.ArrayList<org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto>(enumType_);
- bitField0_ |= 0x00000040;
- }
- }
-
- private org.apache.pekko.protobuf.RepeatedFieldBuilder<
- org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProtoOrBuilder> enumTypeBuilder_;
-
- /**
- * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 5;</code>
- */
- public java.util.List<org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto> getEnumTypeList() {
- if (enumTypeBuilder_ == null) {
- return java.util.Collections.unmodifiableList(enumType_);
- } else {
- return enumTypeBuilder_.getMessageList();
- }
- }
- /**
- * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 5;</code>
- */
- public int getEnumTypeCount() {
- if (enumTypeBuilder_ == null) {
- return enumType_.size();
- } else {
- return enumTypeBuilder_.getCount();
- }
- }
- /**
- * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 5;</code>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto getEnumType(int index) {
- if (enumTypeBuilder_ == null) {
- return enumType_.get(index);
- } else {
- return enumTypeBuilder_.getMessage(index);
- }
- }
- /**
- * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 5;</code>
- */
- public Builder setEnumType(
- int index, org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto value) {
- if (enumTypeBuilder_ == null) {
- if (value == null) {
- throw new NullPointerException();
- }
- ensureEnumTypeIsMutable();
- enumType_.set(index, value);
- onChanged();
- } else {
- enumTypeBuilder_.setMessage(index, value);
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 5;</code>
- */
- public Builder setEnumType(
- int index, org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto.Builder builderForValue) {
- if (enumTypeBuilder_ == null) {
- ensureEnumTypeIsMutable();
- enumType_.set(index, builderForValue.build());
- onChanged();
- } else {
- enumTypeBuilder_.setMessage(index, builderForValue.build());
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 5;</code>
- */
- public Builder addEnumType(org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto value) {
- if (enumTypeBuilder_ == null) {
- if (value == null) {
- throw new NullPointerException();
- }
- ensureEnumTypeIsMutable();
- enumType_.add(value);
- onChanged();
- } else {
- enumTypeBuilder_.addMessage(value);
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 5;</code>
- */
- public Builder addEnumType(
- int index, org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto value) {
- if (enumTypeBuilder_ == null) {
- if (value == null) {
- throw new NullPointerException();
- }
- ensureEnumTypeIsMutable();
- enumType_.add(index, value);
- onChanged();
- } else {
- enumTypeBuilder_.addMessage(index, value);
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 5;</code>
- */
- public Builder addEnumType(
- org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto.Builder builderForValue) {
- if (enumTypeBuilder_ == null) {
- ensureEnumTypeIsMutable();
- enumType_.add(builderForValue.build());
- onChanged();
- } else {
- enumTypeBuilder_.addMessage(builderForValue.build());
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 5;</code>
- */
- public Builder addEnumType(
- int index, org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto.Builder builderForValue) {
- if (enumTypeBuilder_ == null) {
- ensureEnumTypeIsMutable();
- enumType_.add(index, builderForValue.build());
- onChanged();
- } else {
- enumTypeBuilder_.addMessage(index, builderForValue.build());
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 5;</code>
- */
- public Builder addAllEnumType(
- java.lang.Iterable<? extends org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto> values) {
- if (enumTypeBuilder_ == null) {
- ensureEnumTypeIsMutable();
- super.addAll(values, enumType_);
- onChanged();
- } else {
- enumTypeBuilder_.addAllMessages(values);
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 5;</code>
- */
- public Builder clearEnumType() {
- if (enumTypeBuilder_ == null) {
- enumType_ = java.util.Collections.emptyList();
- bitField0_ = (bitField0_ & ~0x00000040);
- onChanged();
- } else {
- enumTypeBuilder_.clear();
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 5;</code>
- */
- public Builder removeEnumType(int index) {
- if (enumTypeBuilder_ == null) {
- ensureEnumTypeIsMutable();
- enumType_.remove(index);
- onChanged();
- } else {
- enumTypeBuilder_.remove(index);
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 5;</code>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto.Builder getEnumTypeBuilder(
- int index) {
- return getEnumTypeFieldBuilder().getBuilder(index);
- }
- /**
- * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 5;</code>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProtoOrBuilder getEnumTypeOrBuilder(
- int index) {
- if (enumTypeBuilder_ == null) {
- return enumType_.get(index); } else {
- return enumTypeBuilder_.getMessageOrBuilder(index);
- }
- }
- /**
- * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 5;</code>
- */
- public java.util.List<? extends org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProtoOrBuilder>
- getEnumTypeOrBuilderList() {
- if (enumTypeBuilder_ != null) {
- return enumTypeBuilder_.getMessageOrBuilderList();
- } else {
- return java.util.Collections.unmodifiableList(enumType_);
- }
- }
- /**
- * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 5;</code>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto.Builder addEnumTypeBuilder() {
- return getEnumTypeFieldBuilder().addBuilder(
- org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto.getDefaultInstance());
- }
- /**
- * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 5;</code>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto.Builder addEnumTypeBuilder(
- int index) {
- return getEnumTypeFieldBuilder().addBuilder(
- index, org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto.getDefaultInstance());
- }
- /**
- * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 5;</code>
- */
- public java.util.List<org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto.Builder>
- getEnumTypeBuilderList() {
- return getEnumTypeFieldBuilder().getBuilderList();
- }
- private org.apache.pekko.protobuf.RepeatedFieldBuilder<
- org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProtoOrBuilder>
- getEnumTypeFieldBuilder() {
- if (enumTypeBuilder_ == null) {
- enumTypeBuilder_ = new org.apache.pekko.protobuf.RepeatedFieldBuilder<
- org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProtoOrBuilder>(
- enumType_,
- ((bitField0_ & 0x00000040) == 0x00000040),
- getParentForChildren(),
- isClean());
- enumType_ = null;
- }
- return enumTypeBuilder_;
- }
-
- // repeated .google.protobuf.ServiceDescriptorProto service = 6;
- private java.util.List<org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto> service_ =
- java.util.Collections.emptyList();
- private void ensureServiceIsMutable() {
- if (!((bitField0_ & 0x00000080) == 0x00000080)) {
- service_ = new java.util.ArrayList<org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto>(service_);
- bitField0_ |= 0x00000080;
- }
- }
-
- private org.apache.pekko.protobuf.RepeatedFieldBuilder<
- org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProtoOrBuilder> serviceBuilder_;
-
- /**
- * <code>repeated .google.protobuf.ServiceDescriptorProto service = 6;</code>
- */
- public java.util.List<org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto> getServiceList() {
- if (serviceBuilder_ == null) {
- return java.util.Collections.unmodifiableList(service_);
- } else {
- return serviceBuilder_.getMessageList();
- }
- }
- /**
- * <code>repeated .google.protobuf.ServiceDescriptorProto service = 6;</code>
- */
- public int getServiceCount() {
- if (serviceBuilder_ == null) {
- return service_.size();
- } else {
- return serviceBuilder_.getCount();
- }
- }
- /**
- * <code>repeated .google.protobuf.ServiceDescriptorProto service = 6;</code>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto getService(int index) {
- if (serviceBuilder_ == null) {
- return service_.get(index);
- } else {
- return serviceBuilder_.getMessage(index);
- }
- }
- /**
- * <code>repeated .google.protobuf.ServiceDescriptorProto service = 6;</code>
- */
- public Builder setService(
- int index, org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto value) {
- if (serviceBuilder_ == null) {
- if (value == null) {
- throw new NullPointerException();
- }
- ensureServiceIsMutable();
- service_.set(index, value);
- onChanged();
- } else {
- serviceBuilder_.setMessage(index, value);
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.ServiceDescriptorProto service = 6;</code>
- */
- public Builder setService(
- int index, org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto.Builder builderForValue) {
- if (serviceBuilder_ == null) {
- ensureServiceIsMutable();
- service_.set(index, builderForValue.build());
- onChanged();
- } else {
- serviceBuilder_.setMessage(index, builderForValue.build());
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.ServiceDescriptorProto service = 6;</code>
- */
- public Builder addService(org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto value) {
- if (serviceBuilder_ == null) {
- if (value == null) {
- throw new NullPointerException();
- }
- ensureServiceIsMutable();
- service_.add(value);
- onChanged();
- } else {
- serviceBuilder_.addMessage(value);
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.ServiceDescriptorProto service = 6;</code>
- */
- public Builder addService(
- int index, org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto value) {
- if (serviceBuilder_ == null) {
- if (value == null) {
- throw new NullPointerException();
- }
- ensureServiceIsMutable();
- service_.add(index, value);
- onChanged();
- } else {
- serviceBuilder_.addMessage(index, value);
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.ServiceDescriptorProto service = 6;</code>
- */
- public Builder addService(
- org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto.Builder builderForValue) {
- if (serviceBuilder_ == null) {
- ensureServiceIsMutable();
- service_.add(builderForValue.build());
- onChanged();
- } else {
- serviceBuilder_.addMessage(builderForValue.build());
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.ServiceDescriptorProto service = 6;</code>
- */
- public Builder addService(
- int index, org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto.Builder builderForValue) {
- if (serviceBuilder_ == null) {
- ensureServiceIsMutable();
- service_.add(index, builderForValue.build());
- onChanged();
- } else {
- serviceBuilder_.addMessage(index, builderForValue.build());
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.ServiceDescriptorProto service = 6;</code>
- */
- public Builder addAllService(
- java.lang.Iterable<? extends org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto> values) {
- if (serviceBuilder_ == null) {
- ensureServiceIsMutable();
- super.addAll(values, service_);
- onChanged();
- } else {
- serviceBuilder_.addAllMessages(values);
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.ServiceDescriptorProto service = 6;</code>
- */
- public Builder clearService() {
- if (serviceBuilder_ == null) {
- service_ = java.util.Collections.emptyList();
- bitField0_ = (bitField0_ & ~0x00000080);
- onChanged();
- } else {
- serviceBuilder_.clear();
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.ServiceDescriptorProto service = 6;</code>
- */
- public Builder removeService(int index) {
- if (serviceBuilder_ == null) {
- ensureServiceIsMutable();
- service_.remove(index);
- onChanged();
- } else {
- serviceBuilder_.remove(index);
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.ServiceDescriptorProto service = 6;</code>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto.Builder getServiceBuilder(
- int index) {
- return getServiceFieldBuilder().getBuilder(index);
- }
- /**
- * <code>repeated .google.protobuf.ServiceDescriptorProto service = 6;</code>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProtoOrBuilder getServiceOrBuilder(
- int index) {
- if (serviceBuilder_ == null) {
- return service_.get(index); } else {
- return serviceBuilder_.getMessageOrBuilder(index);
- }
- }
- /**
- * <code>repeated .google.protobuf.ServiceDescriptorProto service = 6;</code>
- */
- public java.util.List<? extends org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProtoOrBuilder>
- getServiceOrBuilderList() {
- if (serviceBuilder_ != null) {
- return serviceBuilder_.getMessageOrBuilderList();
- } else {
- return java.util.Collections.unmodifiableList(service_);
- }
- }
- /**
- * <code>repeated .google.protobuf.ServiceDescriptorProto service = 6;</code>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto.Builder addServiceBuilder() {
- return getServiceFieldBuilder().addBuilder(
- org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto.getDefaultInstance());
- }
- /**
- * <code>repeated .google.protobuf.ServiceDescriptorProto service = 6;</code>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto.Builder addServiceBuilder(
- int index) {
- return getServiceFieldBuilder().addBuilder(
- index, org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto.getDefaultInstance());
- }
- /**
- * <code>repeated .google.protobuf.ServiceDescriptorProto service = 6;</code>
- */
- public java.util.List<org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto.Builder>
- getServiceBuilderList() {
- return getServiceFieldBuilder().getBuilderList();
- }
- private org.apache.pekko.protobuf.RepeatedFieldBuilder<
- org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProtoOrBuilder>
- getServiceFieldBuilder() {
- if (serviceBuilder_ == null) {
- serviceBuilder_ = new org.apache.pekko.protobuf.RepeatedFieldBuilder<
- org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.ServiceDescriptorProtoOrBuilder>(
- service_,
- ((bitField0_ & 0x00000080) == 0x00000080),
- getParentForChildren(),
- isClean());
- service_ = null;
- }
- return serviceBuilder_;
- }
-
- // repeated .google.protobuf.FieldDescriptorProto extension = 7;
- private java.util.List<org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto> extension_ =
- java.util.Collections.emptyList();
- private void ensureExtensionIsMutable() {
- if (!((bitField0_ & 0x00000100) == 0x00000100)) {
- extension_ = new java.util.ArrayList<org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto>(extension_);
- bitField0_ |= 0x00000100;
- }
- }
-
- private org.apache.pekko.protobuf.RepeatedFieldBuilder<
- org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProtoOrBuilder> extensionBuilder_;
-
- /**
- * <code>repeated .google.protobuf.FieldDescriptorProto extension = 7;</code>
- */
- public java.util.List<org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto> getExtensionList() {
- if (extensionBuilder_ == null) {
- return java.util.Collections.unmodifiableList(extension_);
- } else {
- return extensionBuilder_.getMessageList();
- }
- }
- /**
- * <code>repeated .google.protobuf.FieldDescriptorProto extension = 7;</code>
- */
- public int getExtensionCount() {
- if (extensionBuilder_ == null) {
- return extension_.size();
- } else {
- return extensionBuilder_.getCount();
- }
- }
- /**
- * <code>repeated .google.protobuf.FieldDescriptorProto extension = 7;</code>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto getExtension(int index) {
- if (extensionBuilder_ == null) {
- return extension_.get(index);
- } else {
- return extensionBuilder_.getMessage(index);
- }
- }
- /**
- * <code>repeated .google.protobuf.FieldDescriptorProto extension = 7;</code>
- */
- public Builder setExtension(
- int index, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto value) {
- if (extensionBuilder_ == null) {
- if (value == null) {
- throw new NullPointerException();
- }
- ensureExtensionIsMutable();
- extension_.set(index, value);
- onChanged();
- } else {
- extensionBuilder_.setMessage(index, value);
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.FieldDescriptorProto extension = 7;</code>
- */
- public Builder setExtension(
- int index, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Builder builderForValue) {
- if (extensionBuilder_ == null) {
- ensureExtensionIsMutable();
- extension_.set(index, builderForValue.build());
- onChanged();
- } else {
- extensionBuilder_.setMessage(index, builderForValue.build());
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.FieldDescriptorProto extension = 7;</code>
- */
- public Builder addExtension(org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto value) {
- if (extensionBuilder_ == null) {
- if (value == null) {
- throw new NullPointerException();
- }
- ensureExtensionIsMutable();
- extension_.add(value);
- onChanged();
- } else {
- extensionBuilder_.addMessage(value);
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.FieldDescriptorProto extension = 7;</code>
- */
- public Builder addExtension(
- int index, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto value) {
- if (extensionBuilder_ == null) {
- if (value == null) {
- throw new NullPointerException();
- }
- ensureExtensionIsMutable();
- extension_.add(index, value);
- onChanged();
- } else {
- extensionBuilder_.addMessage(index, value);
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.FieldDescriptorProto extension = 7;</code>
- */
- public Builder addExtension(
- org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Builder builderForValue) {
- if (extensionBuilder_ == null) {
- ensureExtensionIsMutable();
- extension_.add(builderForValue.build());
- onChanged();
- } else {
- extensionBuilder_.addMessage(builderForValue.build());
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.FieldDescriptorProto extension = 7;</code>
- */
- public Builder addExtension(
- int index, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Builder builderForValue) {
- if (extensionBuilder_ == null) {
- ensureExtensionIsMutable();
- extension_.add(index, builderForValue.build());
- onChanged();
- } else {
- extensionBuilder_.addMessage(index, builderForValue.build());
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.FieldDescriptorProto extension = 7;</code>
- */
- public Builder addAllExtension(
- java.lang.Iterable<? extends org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto> values) {
- if (extensionBuilder_ == null) {
- ensureExtensionIsMutable();
- super.addAll(values, extension_);
- onChanged();
- } else {
- extensionBuilder_.addAllMessages(values);
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.FieldDescriptorProto extension = 7;</code>
- */
- public Builder clearExtension() {
- if (extensionBuilder_ == null) {
- extension_ = java.util.Collections.emptyList();
- bitField0_ = (bitField0_ & ~0x00000100);
- onChanged();
- } else {
- extensionBuilder_.clear();
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.FieldDescriptorProto extension = 7;</code>
- */
- public Builder removeExtension(int index) {
- if (extensionBuilder_ == null) {
- ensureExtensionIsMutable();
- extension_.remove(index);
- onChanged();
- } else {
- extensionBuilder_.remove(index);
- }
- return this;
- }
- /**
- * <code>repeated .google.protobuf.FieldDescriptorProto extension = 7;</code>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Builder getExtensionBuilder(
- int index) {
- return getExtensionFieldBuilder().getBuilder(index);
- }
- /**
- * <code>repeated .google.protobuf.FieldDescriptorProto extension = 7;</code>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProtoOrBuilder getExtensionOrBuilder(
- int index) {
- if (extensionBuilder_ == null) {
- return extension_.get(index); } else {
- return extensionBuilder_.getMessageOrBuilder(index);
- }
- }
- /**
- * <code>repeated .google.protobuf.FieldDescriptorProto extension = 7;</code>
- */
- public java.util.List<? extends org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProtoOrBuilder>
- getExtensionOrBuilderList() {
- if (extensionBuilder_ != null) {
- return extensionBuilder_.getMessageOrBuilderList();
- } else {
- return java.util.Collections.unmodifiableList(extension_);
- }
- }
- /**
- * <code>repeated .google.protobuf.FieldDescriptorProto extension = 7;</code>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Builder addExtensionBuilder() {
- return getExtensionFieldBuilder().addBuilder(
- org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.getDefaultInstance());
- }
- /**
- * <code>repeated .google.protobuf.FieldDescriptorProto extension = 7;</code>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Builder addExtensionBuilder(
- int index) {
- return getExtensionFieldBuilder().addBuilder(
- index, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.getDefaultInstance());
- }
- /**
- * <code>repeated .google.protobuf.FieldDescriptorProto extension = 7;</code>
- */
- public java.util.List<org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Builder>
- getExtensionBuilderList() {
- return getExtensionFieldBuilder().getBuilderList();
- }
- private org.apache.pekko.protobuf.RepeatedFieldBuilder<
- org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProtoOrBuilder>
- getExtensionFieldBuilder() {
- if (extensionBuilder_ == null) {
- extensionBuilder_ = new org.apache.pekko.protobuf.RepeatedFieldBuilder<
- org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.Builder, org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProtoOrBuilder>(
- extension_,
- ((bitField0_ & 0x00000100) == 0x00000100),
- getParentForChildren(),
- isClean());
- extension_ = null;
- }
- return extensionBuilder_;
- }
-
- // optional .google.protobuf.FileOptions options = 8;
- private org.apache.pekko.protobuf.DescriptorProtos.FileOptions options_ = org.apache.pekko.protobuf.DescriptorProtos.FileOptions.getDefaultInstance();
- private org.apache.pekko.protobuf.SingleFieldBuilder<
- org.apache.pekko.protobuf.DescriptorProtos.FileOptions, org.apache.pekko.protobuf.DescriptorProtos.FileOptions.Builder, org.apache.pekko.protobuf.DescriptorProtos.FileOptionsOrBuilder> optionsBuilder_;
- /**
- * <code>optional .google.protobuf.FileOptions options = 8;</code>
- */
- public boolean hasOptions() {
- return ((bitField0_ & 0x00000200) == 0x00000200);
- }
- /**
- * <code>optional .google.protobuf.FileOptions options = 8;</code>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.FileOptions getOptions() {
- if (optionsBuilder_ == null) {
- return options_;
- } else {
- return optionsBuilder_.getMessage();
- }
- }
- /**
- * <code>optional .google.protobuf.FileOptions options = 8;</code>
- */
- public Builder setOptions(org.apache.pekko.protobuf.DescriptorProtos.FileOptions value) {
- if (optionsBuilder_ == null) {
- if (value == null) {
- throw new NullPointerException();
- }
- options_ = value;
- onChanged();
- } else {
- optionsBuilder_.setMessage(value);
- }
- bitField0_ |= 0x00000200;
- return this;
- }
- /**
- * <code>optional .google.protobuf.FileOptions options = 8;</code>
- */
- public Builder setOptions(
- org.apache.pekko.protobuf.DescriptorProtos.FileOptions.Builder builderForValue) {
- if (optionsBuilder_ == null) {
- options_ = builderForValue.build();
- onChanged();
- } else {
- optionsBuilder_.setMessage(builderForValue.build());
- }
- bitField0_ |= 0x00000200;
- return this;
- }
- /**
- * <code>optional .google.protobuf.FileOptions options = 8;</code>
- */
- public Builder mergeOptions(org.apache.pekko.protobuf.DescriptorProtos.FileOptions value) {
- if (optionsBuilder_ == null) {
- if (((bitField0_ & 0x00000200) == 0x00000200) &&
- options_ != org.apache.pekko.protobuf.DescriptorProtos.FileOptions.getDefaultInstance()) {
- options_ =
- org.apache.pekko.protobuf.DescriptorProtos.FileOptions.newBuilder(options_).mergeFrom(value).buildPartial();
- } else {
- options_ = value;
- }
- onChanged();
- } else {
- optionsBuilder_.mergeFrom(value);
- }
- bitField0_ |= 0x00000200;
- return this;
- }
- /**
- * <code>optional .google.protobuf.FileOptions options = 8;</code>
- */
- public Builder clearOptions() {
- if (optionsBuilder_ == null) {
- options_ = org.apache.pekko.protobuf.DescriptorProtos.FileOptions.getDefaultInstance();
- onChanged();
- } else {
- optionsBuilder_.clear();
- }
- bitField0_ = (bitField0_ & ~0x00000200);
- return this;
- }
- /**
- * <code>optional .google.protobuf.FileOptions options = 8;</code>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.FileOptions.Builder getOptionsBuilder() {
- bitField0_ |= 0x00000200;
- onChanged();
- return getOptionsFieldBuilder().getBuilder();
- }
- /**
- * <code>optional .google.protobuf.FileOptions options = 8;</code>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.FileOptionsOrBuilder getOptionsOrBuilder() {
- if (optionsBuilder_ != null) {
- return optionsBuilder_.getMessageOrBuilder();
- } else {
- return options_;
- }
- }
- /**
- * <code>optional .google.protobuf.FileOptions options = 8;</code>
- */
- private org.apache.pekko.protobuf.SingleFieldBuilder<
- org.apache.pekko.protobuf.DescriptorProtos.FileOptions, org.apache.pekko.protobuf.DescriptorProtos.FileOptions.Builder, org.apache.pekko.protobuf.DescriptorProtos.FileOptionsOrBuilder>
- getOptionsFieldBuilder() {
- if (optionsBuilder_ == null) {
- optionsBuilder_ = new org.apache.pekko.protobuf.SingleFieldBuilder<
- org.apache.pekko.protobuf.DescriptorProtos.FileOptions, org.apache.pekko.protobuf.DescriptorProtos.FileOptions.Builder, org.apache.pekko.protobuf.DescriptorProtos.FileOptionsOrBuilder>(
- options_,
- getParentForChildren(),
- isClean());
- options_ = null;
- }
- return optionsBuilder_;
- }
-
- // optional .google.protobuf.SourceCodeInfo source_code_info = 9;
- private org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo sourceCodeInfo_ = org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo.getDefaultInstance();
- private org.apache.pekko.protobuf.SingleFieldBuilder<
- org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo, org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo.Builder, org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfoOrBuilder> sourceCodeInfoBuilder_;
- /**
- * <code>optional .google.protobuf.SourceCodeInfo source_code_info = 9;</code>
- *
- * <pre>
- * This field contains optional information about the original source code.
- * You may safely remove this entire field whithout harming runtime
- * functionality of the descriptors -- the information is needed only by
- * development tools.
- * </pre>
- */
- public boolean hasSourceCodeInfo() {
- return ((bitField0_ & 0x00000400) == 0x00000400);
- }
- /**
- * <code>optional .google.protobuf.SourceCodeInfo source_code_info = 9;</code>
- *
- * <pre>
- * This field contains optional information about the original source code.
- * You may safely remove this entire field whithout harming runtime
- * functionality of the descriptors -- the information is needed only by
- * development tools.
- * </pre>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo getSourceCodeInfo() {
- if (sourceCodeInfoBuilder_ == null) {
- return sourceCodeInfo_;
- } else {
- return sourceCodeInfoBuilder_.getMessage();
- }
- }
- /**
- * <code>optional .google.protobuf.SourceCodeInfo source_code_info = 9;</code>
- *
- * <pre>
- * This field contains optional information about the original source code.
- * You may safely remove this entire field whithout harming runtime
- * functionality of the descriptors -- the information is needed only by
- * development tools.
- * </pre>
- */
- public Builder setSourceCodeInfo(org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo value) {
- if (sourceCodeInfoBuilder_ == null) {
- if (value == null) {
- throw new NullPointerException();
- }
- sourceCodeInfo_ = value;
- onChanged();
- } else {
- sourceCodeInfoBuilder_.setMessage(value);
- }
- bitField0_ |= 0x00000400;
- return this;
- }
- /**
- * <code>optional .google.protobuf.SourceCodeInfo source_code_info = 9;</code>
- *
- * <pre>
- * This field contains optional information about the original source code.
- * You may safely remove this entire field whithout harming runtime
- * functionality of the descriptors -- the information is needed only by
- * development tools.
- * </pre>
- */
- public Builder setSourceCodeInfo(
- org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo.Builder builderForValue) {
- if (sourceCodeInfoBuilder_ == null) {
- sourceCodeInfo_ = builderForValue.build();
- onChanged();
- } else {
- sourceCodeInfoBuilder_.setMessage(builderForValue.build());
- }
- bitField0_ |= 0x00000400;
- return this;
- }
- /**
- * <code>optional .google.protobuf.SourceCodeInfo source_code_info = 9;</code>
- *
- * <pre>
- * This field contains optional information about the original source code.
- * You may safely remove this entire field whithout harming runtime
- * functionality of the descriptors -- the information is needed only by
- * development tools.
- * </pre>
- */
- public Builder mergeSourceCodeInfo(org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo value) {
- if (sourceCodeInfoBuilder_ == null) {
- if (((bitField0_ & 0x00000400) == 0x00000400) &&
- sourceCodeInfo_ != org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo.getDefaultInstance()) {
- sourceCodeInfo_ =
- org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo.newBuilder(sourceCodeInfo_).mergeFrom(value).buildPartial();
- } else {
- sourceCodeInfo_ = value;
- }
- onChanged();
- } else {
- sourceCodeInfoBuilder_.mergeFrom(value);
- }
- bitField0_ |= 0x00000400;
- return this;
- }
- /**
- * <code>optional .google.protobuf.SourceCodeInfo source_code_info = 9;</code>
- *
- * <pre>
- * This field contains optional information about the original source code.
- * You may safely remove this entire field whithout harming runtime
- * functionality of the descriptors -- the information is needed only by
- * development tools.
- * </pre>
- */
- public Builder clearSourceCodeInfo() {
- if (sourceCodeInfoBuilder_ == null) {
- sourceCodeInfo_ = org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo.getDefaultInstance();
- onChanged();
- } else {
- sourceCodeInfoBuilder_.clear();
- }
- bitField0_ = (bitField0_ & ~0x00000400);
- return this;
- }
- /**
- * <code>optional .google.protobuf.SourceCodeInfo source_code_info = 9;</code>
- *
- * <pre>
- * This field contains optional information about the original source code.
- * You may safely remove this entire field whithout harming runtime
- * functionality of the descriptors -- the information is needed only by
- * development tools.
- * </pre>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo.Builder getSourceCodeInfoBuilder() {
- bitField0_ |= 0x00000400;
- onChanged();
- return getSourceCodeInfoFieldBuilder().getBuilder();
- }
- /**
- * <code>optional .google.protobuf.SourceCodeInfo source_code_info = 9;</code>
- *
- * <pre>
- * This field contains optional information about the original source code.
- * You may safely remove this entire field whithout harming runtime
- * functionality of the descriptors -- the information is needed only by
- * development tools.
- * </pre>
- */
- public org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfoOrBuilder getSourceCodeInfoOrBuilder() {
- if (sourceCodeInfoBuilder_ != null) {
- return sourceCodeInfoBuilder_.getMessageOrBuilder();
- } else {
- return sourceCodeInfo_;
- }
- }
- /**
- * <code>optional .google.protobuf.SourceCodeInfo source_code_info = 9;</code>
- *
- * <pre>
- * This field contains optional information about the original source code.
- * You may safely remove this entire field whithout harming runtime
- * functionality of the descriptors -- the information is needed only by
- * development tools.
- * </pre>
- */
- private org.apache.pekko.protobuf.SingleFieldBuilder<
- org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo, org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo.Builder, org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfoOrBuilder>
- getSourceCodeInfoFieldBuilder() {
- if (sourceCodeInfoBuilder_ == null) {
- sourceCodeInfoBuilder_ = new org.apache.pekko.protobuf.SingleFieldBuilder<
- org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo, org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfo.Builder, org.apache.pekko.protobuf.DescriptorProtos.SourceCodeInfoOrBuilder>(
- sourceCodeInfo_,
- getParentForChildren(),
- isClean());
- sourceCodeInfo_ = null;
- }
- return sourceCodeInfoBuilder_;
- }
-
- // @@protoc_insertion_point(builder_scope:google.protobuf.FileDescriptorProto)
- }
-
- static {
- defaultInstance = new FileDescriptorProto(true);
- defaultInstance.initFields();
- }
-
- // @@protoc_insertion_point(class_scope:google.protobuf.FileDescriptorProto)
- }
-
- public interface DescriptorProtoOrBuilder
- extends org.apache.pekko.protobuf.MessageOrBuilder {
-
- // optional string name = 1;
- /**
- * <code>optional string name = 1;</code>
- */
- boolean hasName();
- /**
- * <code>optional string name = 1;</code>
- */
- java.lang.String getName();
- /**
- * <code>optional string name = 1;</code>
- */
- org.apache.pekko.protobuf.ByteString
- getNameBytes();
-
- // repeated .google.protobuf.FieldDescriptorProto field = 2;
- /**
- * <code>repeated .google.protobuf.FieldDescriptorProto field = 2;</code>
- */
- java.util.List<org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto>
- getFieldList();
- /**
- * <code>repeated .google.protobuf.FieldDescriptorProto field = 2;</code>
- */
- org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto getField(int index);
- /**
- * <code>repeated .google.protobuf.FieldDescriptorProto field = 2;</code>
- */
- int getFieldCount();
- /**
- * <code>repeated .google.protobuf.FieldDescriptorProto field = 2;</code>
- */
- java.util.List<? extends org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProtoOrBuilder>
- getFieldOrBuilderList();
- /**
- * <code>repeated .google.protobuf.FieldDescriptorProto field = 2;</code>
- */
- org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProtoOrBuilder getFieldOrBuilder(
- int index);
-
- // repeated .google.protobuf.FieldDescriptorProto extension = 6;
- /**
- * <code>repeated .google.protobuf.FieldDescriptorProto extension = 6;</code>
- */
- java.util.List<org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto>
- getExtensionList();
- /**
- * <code>repeated .google.protobuf.FieldDescriptorProto extension = 6;</code>
- */
- org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto getExtension(int index);
- /**
- * <code>repeated .google.protobuf.FieldDescriptorProto extension = 6;</code>
- */
- int getExtensionCount();
- /**
- * <code>repeated .google.protobuf.FieldDescriptorProto extension = 6;</code>
- */
- java.util.List<? extends org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProtoOrBuilder>
- getExtensionOrBuilderList();
- /**
- * <code>repeated .google.protobuf.FieldDescriptorProto extension = 6;</code>
- */
- org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProtoOrBuilder getExtensionOrBuilder(
- int index);
-
- // repeated .google.protobuf.DescriptorProto nested_type = 3;
- /**
- * <code>repeated .google.protobuf.DescriptorProto nested_type = 3;</code>
- */
- java.util.List<org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto>
- getNestedTypeList();
- /**
- * <code>repeated .google.protobuf.DescriptorProto nested_type = 3;</code>
- */
- org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto getNestedType(int index);
- /**
- * <code>repeated .google.protobuf.DescriptorProto nested_type = 3;</code>
- */
- int getNestedTypeCount();
- /**
- * <code>repeated .google.protobuf.DescriptorProto nested_type = 3;</code>
- */
- java.util.List<? extends org.apache.pekko.protobuf.DescriptorProtos.DescriptorProtoOrBuilder>
- getNestedTypeOrBuilderList();
- /**
- * <code>repeated .google.protobuf.DescriptorProto nested_type = 3;</code>
- */
- org.apache.pekko.protobuf.DescriptorProtos.DescriptorProtoOrBuilder getNestedTypeOrBuilder(
- int index);
-
- // repeated .google.protobuf.EnumDescriptorProto enum_type = 4;
- /**
- * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 4;</code>
- */
- java.util.List<org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto>
- getEnumTypeList();
- /**
- * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 4;</code>
- */
- org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto getEnumType(int index);
- /**
- * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 4;</code>
- */
- int getEnumTypeCount();
- /**
- * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 4;</code>
- */
- java.util.List<? extends org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProtoOrBuilder>
- getEnumTypeOrBuilderList();
- /**
- * <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 4;</code>
- */
- org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProtoOrBuilder getEnumTypeOrBuilder(
- int index);
-
- // repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5;
- /**
- * <code>repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5;</code>
- */
- java.util.List<org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange>
- getExtensionRangeList();
- /**
- * <code>repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5;</code>
- */
- org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange getExtensionRange(int index);
- /**
- * <code>repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5;</code>
- */
- int getExtensionRangeCount();
- /**
- * <code>repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5;</code>
- */
- java.util.List<? extends org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRangeOrBuilder>
- getExtensionRangeOrBuilderList();
- /**
- * <code>repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5;</code>
- */
- org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRangeOrBuilder getExtensionRangeOrBuilder(
- int index);
-
- // optional .google.protobuf.MessageOptions options = 7;
- /**
- * <code>optional .google.protobuf.MessageOptions options = 7;</code>
- */
- boolean hasOptions();
- /**
- * <code>optional .google.protobuf.MessageOptions options = 7;</code>
- */
- org.apache.pekko.protobuf.DescriptorProtos.MessageOptions getOptions();
- /**
- * <code>optional .google.protobuf.MessageOptions options = 7;</code>
- */
- org.apache.pekko.protobuf.DescriptorProtos.MessageOptionsOrBuilder getOptionsOrBuilder();
- }
- /**
- * Protobuf type {@code google.protobuf.DescriptorProto}
- *
- * <pre>
- * Describes a message type.
- * </pre>
- */
- public static final class DescriptorProto extends
- org.apache.pekko.protobuf.GeneratedMessage
- implements DescriptorProtoOrBuilder {
- // Use DescriptorProto.newBuilder() to construct.
- private DescriptorProto(org.apache.pekko.protobuf.GeneratedMessage.Builder<?> builder) {
- super(builder);
- this.unknownFields = builder.getUnknownFields();
- }
- private DescriptorProto(boolean noInit) { this.unknownFields = org.apache.pekko.protobuf.UnknownFieldSet.getDefaultInstance(); }
-
- private static final DescriptorProto defaultInstance;
- public static DescriptorProto getDefaultInstance() {
- return defaultInstance;
- }
-
- public DescriptorProto getDefaultInstanceForType() {
- return defaultInstance;
- }
-
- private final org.apache.pekko.protobuf.UnknownFieldSet unknownFields;
- @java.lang.Override
- public final org.apache.pekko.protobuf.UnknownFieldSet
- getUnknownFields() {
- return this.unknownFields;
- }
- private DescriptorProto(
- org.apache.pekko.protobuf.CodedInputStream input,
- org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry)
- throws org.apache.pekko.protobuf.InvalidProtocolBufferException {
- initFields();
- int mutable_bitField0_ = 0;
- org.apache.pekko.protobuf.UnknownFieldSet.Builder unknownFields =
- org.apache.pekko.protobuf.UnknownFieldSet.newBuilder();
- try {
- boolean done = false;
- while (!done) {
- int tag = input.readTag();
- switch (tag) {
- case 0:
- done = true;
- break;
- default: {
- if (!parseUnknownField(input, unknownFields,
- extensionRegistry, tag)) {
- done = true;
- }
- break;
- }
- case 10: {
- bitField0_ |= 0x00000001;
- name_ = input.readBytes();
- break;
- }
- case 18: {
- if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
- field_ = new java.util.ArrayList<org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto>();
- mutable_bitField0_ |= 0x00000002;
- }
- field_.add(input.readMessage(org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.PARSER, extensionRegistry));
- break;
- }
- case 26: {
- if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
- nestedType_ = new java.util.ArrayList<org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto>();
- mutable_bitField0_ |= 0x00000008;
- }
- nestedType_.add(input.readMessage(org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.PARSER, extensionRegistry));
- break;
- }
- case 34: {
- if (!((mutable_bitField0_ & 0x00000010) == 0x00000010)) {
- enumType_ = new java.util.ArrayList<org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto>();
- mutable_bitField0_ |= 0x00000010;
- }
- enumType_.add(input.readMessage(org.apache.pekko.protobuf.DescriptorProtos.EnumDescriptorProto.PARSER, extensionRegistry));
- break;
- }
- case 42: {
- if (!((mutable_bitField0_ & 0x00000020) == 0x00000020)) {
- extensionRange_ = new java.util.ArrayList<org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange>();
- mutable_bitField0_ |= 0x00000020;
- }
- extensionRange_.add(input.readMessage(org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.ExtensionRange.PARSER, extensionRegistry));
- break;
- }
- case 50: {
- if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
- extension_ = new java.util.ArrayList<org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto>();
- mutable_bitField0_ |= 0x00000004;
- }
- extension_.add(input.readMessage(org.apache.pekko.protobuf.DescriptorProtos.FieldDescriptorProto.PARSER, extensionRegistry));
- break;
- }
- case 58: {
- org.apache.pekko.protobuf.DescriptorProtos.MessageOptions.Builder subBuilder = null;
- if (((bitField0_ & 0x00000002) == 0x00000002)) {
- subBuilder = options_.toBuilder();
- }
- options_ = input.readMessage(org.apache.pekko.protobuf.DescriptorProtos.MessageOptions.PARSER, extensionRegistry);
- if (subBuilder != null) {
- subBuilder.mergeFrom(options_);
- options_ = subBuilder.buildPartial();
- }
- bitField0_ |= 0x00000002;
- break;
- }
- }
- }
- } catch (org.apache.pekko.protobuf.InvalidProtocolBufferException e) {
- throw e.setUnfinishedMessage(this);
- } catch (java.io.IOException e) {
- throw new org.apache.pekko.protobuf.InvalidProtocolBufferException(
- e.getMessage()).setUnfinishedMessage(this);
- } finally {
- if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
- field_ = java.util.Collections.unmodifiableList(field_);
- }
- if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
- nestedType_ = java.util.Collections.unmodifiableList(nestedType_);
- }
- if (((mutable_bitField0_ & 0x00000010) == 0x00000010)) {
- enumType_ = java.util.Collections.unmodifiableList(enumType_);
- }
- if (((mutable_bitField0_ & 0x00000020) == 0x00000020)) {
- extensionRange_ = java.util.Collections.unmodifiableList(extensionRange_);
- }
- if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
- extension_ = java.util.Collections.unmodifiableList(extension_);
- }
- this.unknownFields = unknownFields.build();
- makeExtensionsImmutable();
- }
- }
- public static final org.apache.pekko.protobuf.Descriptors.Descriptor
- getDescriptor() {
- return org.apache.pekko.protobuf.DescriptorProtos.internal_static_google_protobuf_DescriptorProto_descriptor;
- }
-
- protected org.apache.pekko.protobuf.GeneratedMessage.FieldAccessorTable
- internalGetFieldAccessorTable() {
- return org.apache.pekko.protobuf.DescriptorProtos.internal_static_google_protobuf_DescriptorProto_fieldAccessorTable
- .ensureFieldAccessorsInitialized(
- org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.class, org.apache.pekko.protobuf.DescriptorProtos.DescriptorProto.Builder.class);
- }
-
- public static org.apache.pekko.protobuf.Parser<DescriptorProto> PARSER =
- new org.apache.pekko.protobuf.AbstractParser<DescriptorProto>() {
- public DescriptorProto parsePartialFrom(
- org.apache.pekko.protobuf.CodedInputStream input,
- org.apache.pekko.protobuf.ExtensionRegistryLite extensionRegistry)
- throws org.apache.pekko.protobuf.InvalidProtocolBufferException {
... 39597 lines suppressed ...
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pekko.apache.org
For additional commands, e-mail: commits-help@pekko.apache.org