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)
69
throws
InvalidProtocolBufferException
;
70
75
public
MessageType
parsePartialFrom
(
CodedInputStream
input
)
throws
InvalidProtocolBufferException
;
76
81
public
MessageType
parsePartialFrom
(
82
CodedInputStream
input
,
ExtensionRegistryLite
extensionRegistry)
83
throws
InvalidProtocolBufferException
;
84
85
// ---------------------------------------------------------------
86
// Convenience methods.
87
92
public
MessageType
parseFrom
(ByteBuffer
data
)
throws
InvalidProtocolBufferException
;
93
98
public
MessageType
parseFrom
(ByteBuffer
data
,
ExtensionRegistryLite
extensionRegistry)
99
throws
InvalidProtocolBufferException
;
104
public
MessageType
parseFrom
(
ByteString
data
)
throws
InvalidProtocolBufferException
;
105
110
public
MessageType
parseFrom
(
ByteString
data
,
ExtensionRegistryLite
extensionRegistry)
111
throws
InvalidProtocolBufferException
;
112
117
public
MessageType
parsePartialFrom
(
ByteString
data
)
throws
InvalidProtocolBufferException
;
118
123
public
MessageType
parsePartialFrom
(
ByteString
data
,
ExtensionRegistryLite
extensionRegistry)
124
throws
InvalidProtocolBufferException
;
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)
138
throws
InvalidProtocolBufferException
;
139
144
public
MessageType
parseFrom
(
byte
[]
data
)
throws
InvalidProtocolBufferException
;
145
150
public
MessageType
parseFrom
(
byte
[]
data
,
ExtensionRegistryLite
extensionRegistry)
151
throws
InvalidProtocolBufferException
;
152
157
public
MessageType
parsePartialFrom
(
byte
[]
data
,
int
off,
int
len
)
158
throws
InvalidProtocolBufferException
;
159
164
public
MessageType
parsePartialFrom
(
165
byte
[]
data
,
int
off,
int
len
,
ExtensionRegistryLite
extensionRegistry)
166
throws
InvalidProtocolBufferException
;
167
172
public
MessageType
parsePartialFrom
(
byte
[]
data
)
throws
InvalidProtocolBufferException
;
173
178
public
MessageType
parsePartialFrom
(
byte
[]
data
,
ExtensionRegistryLite
extensionRegistry)
179
throws
InvalidProtocolBufferException
;
180
191
public
MessageType
parseFrom
(InputStream
input
)
throws
InvalidProtocolBufferException
;
192
197
public
MessageType
parseFrom
(InputStream
input
,
ExtensionRegistryLite
extensionRegistry)
198
throws
InvalidProtocolBufferException
;
199
204
public
MessageType
parsePartialFrom
(InputStream
input
)
throws
InvalidProtocolBufferException
;
205
210
public
MessageType
parsePartialFrom
(InputStream
input
,
ExtensionRegistryLite
extensionRegistry)
211
throws
InvalidProtocolBufferException
;
212
222
public
MessageType
parseDelimitedFrom
(InputStream
input
)
throws
InvalidProtocolBufferException
;
223
225
public
MessageType
parseDelimitedFrom
(InputStream
input
,
ExtensionRegistryLite
extensionRegistry)
226
throws
InvalidProtocolBufferException
;
227
232
public
MessageType
parsePartialDelimitedFrom
(InputStream
input
)
233
throws
InvalidProtocolBufferException
;
234
239
public
MessageType
parsePartialDelimitedFrom
(
240
InputStream
input
,
ExtensionRegistryLite
extensionRegistry)
241
throws
InvalidProtocolBufferException
;
242
}
input
std::string input
Definition:
tokenizer_unittest.cc:197
com.google.protobuf.Parser.parsePartialFrom
MessageType parsePartialFrom(CodedInputStream input)
com.google.protobuf.Parser
Definition:
Parser.java:47
com.google.protobuf.CodedInputStream
Definition:
CodedInputStream.java:61
com.google.protobuf.Parser.parseFrom
MessageType parseFrom(CodedInputStream input)
com.google.protobuf.Parser.parseDelimitedFrom
MessageType parseDelimitedFrom(InputStream input)
com.google.protobuf.Parser.parsePartialDelimitedFrom
MessageType parsePartialDelimitedFrom(InputStream input)
com.google.protobuf.ExtensionRegistryLite
Definition:
ExtensionRegistryLite.java:70
java
len
int len
Definition:
php/ext/google/protobuf/map.c:206
data
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition:
glcorearb.h:2879
com.google.protobuf.InvalidProtocolBufferException
Definition:
InvalidProtocolBufferException.java:41
com.google.protobuf.ByteString
Definition:
ByteString.java:67
libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:57