Reader.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.IOException;
34 import java.util.List;
35 import java.util.Map;
36 
38 // TODO(nathanmittler): Refactor to allow the reader to allocate properly sized lists.
39 @ExperimentalApi
40 interface Reader {
42  int READ_DONE = Integer.MAX_VALUE;
43 
45  int TAG_UNKNOWN = 0;
46 
47  boolean shouldDiscardUnknownFields();
48 
57  int getFieldNumber() throws IOException;
58 
65  int getTag();
66 
73  boolean skipField() throws IOException;
74 
79  double readDouble() throws IOException;
80 
85  float readFloat() throws IOException;
86 
91  long readUInt64() throws IOException;
92 
97  long readInt64() throws IOException;
98 
103  int readInt32() throws IOException;
104 
109  long readFixed64() throws IOException;
110 
115  int readFixed32() throws IOException;
116 
121  boolean readBool() throws IOException;
122 
128  String readString() throws IOException;
129 
135  String readStringRequireUtf8() throws IOException;
136 
137  // TODO(yilunchong): the lack of other opinions for whether to expose this on the interface
138  <T> T readMessageBySchemaWithCheck(Schema<T> schema, ExtensionRegistryLite extensionRegistry)
139  throws IOException;
140 
145  <T> T readMessage(Class<T> clazz, ExtensionRegistryLite extensionRegistry) throws IOException;
146 
153  @Deprecated
154  <T> T readGroup(Class<T> clazz, ExtensionRegistryLite extensionRegistry) throws IOException;
155 
156  // TODO(yilunchong): the lack of other opinions for whether to expose this on the interface
157  @Deprecated
158  <T> T readGroupBySchemaWithCheck(Schema<T> schema, ExtensionRegistryLite extensionRegistry)
159  throws IOException;
160 
165  ByteString readBytes() throws IOException;
166 
171  int readUInt32() throws IOException;
172 
177  int readEnum() throws IOException;
178 
183  int readSFixed32() throws IOException;
184 
189  long readSFixed64() throws IOException;
190 
195  int readSInt32() throws IOException;
196 
201  long readSInt64() throws IOException;
202 
209  void readDoubleList(List<Double> target) throws IOException;
210 
217  void readFloatList(List<Float> target) throws IOException;
218 
225  void readUInt64List(List<Long> target) throws IOException;
226 
233  void readInt64List(List<Long> target) throws IOException;
234 
241  void readInt32List(List<Integer> target) throws IOException;
242 
249  void readFixed64List(List<Long> target) throws IOException;
250 
257  void readFixed32List(List<Integer> target) throws IOException;
258 
265  void readBoolList(List<Boolean> target) throws IOException;
266 
272  void readStringList(List<String> target) throws IOException;
273 
280  void readStringListRequireUtf8(List<String> target) throws IOException;
281 
288  <T> void readMessageList(
289  List<T> target, Schema<T> schema, ExtensionRegistryLite extensionRegistry) throws IOException;
290 
291  <T> void readMessageList(
292  List<T> target, Class<T> targetType, ExtensionRegistryLite extensionRegistry)
293  throws IOException;
294 
302  @Deprecated
303  <T> void readGroupList(
304  List<T> target, Class<T> targetType, ExtensionRegistryLite extensionRegistry)
305  throws IOException;
306 
307  @Deprecated
308  <T> void readGroupList(
309  List<T> target, Schema<T> targetType, ExtensionRegistryLite extensionRegistry)
310  throws IOException;
311 
317  void readBytesList(List<ByteString> target) throws IOException;
318 
325  void readUInt32List(List<Integer> target) throws IOException;
326 
333  void readEnumList(List<Integer> target) throws IOException;
334 
341  void readSFixed32List(List<Integer> target) throws IOException;
342 
349  void readSFixed64List(List<Long> target) throws IOException;
350 
357  void readSInt32List(List<Integer> target) throws IOException;
358 
365  void readSInt64List(List<Long> target) throws IOException;
366 
374  <K, V> void readMap(
375  Map<K, V> target,
376  MapEntryLite.Metadata<K, V> mapDefaultEntry,
377  ExtensionRegistryLite extensionRegistry)
378  throws IOException;
379 }
K
#define K(t)
Definition: sha1.c:43
Map
Definition: ruby/ext/google/protobuf_c/protobuf.h:442
target
GLenum target
Definition: glcorearb.h:3739
T
#define T(upbtypeconst, upbtype, ctype, default_value)
testing::internal::Double
FloatingPoint< double > Double
Definition: gtest-internal.h:429
testing::internal::Float
FloatingPoint< float > Float
Definition: gtest-internal.h:428
java


libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:58