bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/Parser.java
Go to the documentation of this file.
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 // * Redistributions in binary form must reproduce the above
12 // copyright notice, this list of conditions and the following disclaimer
13 // in the documentation and/or other materials provided with the
14 // distribution.
15 // * Neither the name of Google Inc. nor the names of its
16 // contributors may be used to endorse or promote products derived from
17 // this software without specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 package com.google.protobuf;
32 
33 import java.io.InputStream;
34 import java.nio.ByteBuffer;
35 
47 public interface Parser<MessageType> {
48 
49  // NB(jh): Other parts of the protobuf API that parse messages distinguish between an I/O problem
50  // (like failure reading bytes from a socket) and invalid data (encoding error) via the type of
51  // thrown exception. But it would be source-incompatible to make the methods in this interface do
52  // so since they were originally spec'ed to only throw InvalidProtocolBufferException. So callers
53  // must inspect the cause of the exception to distinguish these two cases.
54 
61  public MessageType parseFrom(CodedInputStream input) throws InvalidProtocolBufferException;
62 
68  public MessageType parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
70 
75  public MessageType parsePartialFrom(CodedInputStream input) throws InvalidProtocolBufferException;
76 
81  public MessageType parsePartialFrom(
82  CodedInputStream input, ExtensionRegistryLite extensionRegistry)
84 
85  // ---------------------------------------------------------------
86  // Convenience methods.
87 
92  public MessageType parseFrom(ByteBuffer data) throws InvalidProtocolBufferException;
93 
98  public MessageType parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
104  public MessageType parseFrom(ByteString data) throws InvalidProtocolBufferException;
105 
110  public MessageType parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
112 
117  public MessageType parsePartialFrom(ByteString data) throws InvalidProtocolBufferException;
118 
123  public MessageType parsePartialFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
125 
130  public MessageType parseFrom(byte[] data, int off, int len) throws InvalidProtocolBufferException;
131 
136  public MessageType parseFrom(
137  byte[] data, int off, int len, ExtensionRegistryLite extensionRegistry)
139 
144  public MessageType parseFrom(byte[] data) throws InvalidProtocolBufferException;
145 
150  public MessageType parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
152 
157  public MessageType parsePartialFrom(byte[] data, int off, int len)
159 
164  public MessageType parsePartialFrom(
165  byte[] data, int off, int len, ExtensionRegistryLite extensionRegistry)
167 
172  public MessageType parsePartialFrom(byte[] data) throws InvalidProtocolBufferException;
173 
178  public MessageType parsePartialFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
180 
191  public MessageType parseFrom(InputStream input) throws InvalidProtocolBufferException;
192 
197  public MessageType parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
199 
204  public MessageType parsePartialFrom(InputStream input) throws InvalidProtocolBufferException;
205 
210  public MessageType parsePartialFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
212 
222  public MessageType parseDelimitedFrom(InputStream input) throws InvalidProtocolBufferException;
223 
225  public MessageType parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
227 
232  public MessageType parsePartialDelimitedFrom(InputStream input)
234 
239  public MessageType parsePartialDelimitedFrom(
240  InputStream input, ExtensionRegistryLite extensionRegistry)
242 }
com.google.protobuf.Parser
Definition: bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/Parser.java:47
com.google.protobuf.CodedInputStream
Definition: bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/CodedInputStream.java:61
data
char data[kBufferLength]
Definition: abseil-cpp/absl/strings/internal/str_format/float_conversion.cc:1006
com.google.protobuf.ExtensionRegistryLite
Definition: bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/ExtensionRegistryLite.java:70
java
input
std::string input
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/tokenizer_unittest.cc:197
com.google.protobuf.InvalidProtocolBufferException
Definition: bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java:41
len
int len
Definition: abseil-cpp/absl/base/internal/low_level_alloc_test.cc:46
com.google.protobuf.ByteString
Definition: bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/ByteString.java:67


grpc
Author(s):
autogenerated on Fri May 16 2025 02:59:40