31 package com.google.protobuf;
42 import java.io.IOException;
43 import java.util.List;
48 final class CodedInputStreamReader
implements Reader {
49 private static final int FIXED32_MULTIPLE_MASK = FIXED32_SIZE - 1;
50 private static final int FIXED64_MULTIPLE_MASK = FIXED64_SIZE - 1;
51 private static final int NEXT_TAG_UNSET = 0;
53 private final CodedInputStream
input;
55 private int endGroupTag;
56 private int nextTag = NEXT_TAG_UNSET;
58 public static CodedInputStreamReader forCodedInput(CodedInputStream
input) {
59 if (
input.wrapper !=
null) {
62 return new CodedInputStreamReader(
input);
65 private CodedInputStreamReader(CodedInputStream
input) {
66 this.input = Internal.checkNotNull(
input,
"input");
67 this.input.wrapper =
this;
71 public boolean shouldDiscardUnknownFields() {
72 return input.shouldDiscardUnknownFields();
76 public int getFieldNumber() throws IOException {
77 if (nextTag != NEXT_TAG_UNSET) {
79 nextTag = NEXT_TAG_UNSET;
81 tag =
input.readTag();
83 if (tag == 0 || tag == endGroupTag) {
84 return Reader.READ_DONE;
86 return WireFormat.getTagFieldNumber(tag);
95 public boolean skipField() throws IOException {
96 if (
input.isAtEnd() || tag == endGroupTag) {
99 return input.skipField(tag);
102 private void requireWireType(
int requiredWireType)
throws IOException {
103 if (WireFormat.getTagWireType(tag) != requiredWireType) {
104 throw InvalidProtocolBufferException.invalidWireType();
109 public double readDouble() throws IOException {
111 return input.readDouble();
115 public float readFloat() throws IOException {
117 return input.readFloat();
121 public long readUInt64() throws IOException {
123 return input.readUInt64();
127 public long readInt64() throws IOException {
129 return input.readInt64();
133 public int readInt32() throws IOException {
135 return input.readInt32();
139 public long readFixed64() throws IOException {
141 return input.readFixed64();
145 public int readFixed32() throws IOException {
147 return input.readFixed32();
151 public boolean readBool() throws IOException {
153 return input.readBool();
157 public String readString() throws IOException {
159 return input.readString();
163 public String readStringRequireUtf8() throws IOException {
165 return input.readStringRequireUtf8();
168 @SuppressWarnings(
"unchecked")
170 public <T>
T readMessage(Class<T> clazz, ExtensionRegistryLite extensionRegistry)
173 return readMessage(Protobuf.getInstance().schemaFor(clazz), extensionRegistry);
176 @SuppressWarnings(
"unchecked")
178 public <T>
T readMessageBySchemaWithCheck(
179 Schema<T> schema, ExtensionRegistryLite extensionRegistry)
throws IOException {
181 return readMessage(schema, extensionRegistry);
184 @SuppressWarnings(
"unchecked")
186 public <T>
T readGroup(Class<T> clazz, ExtensionRegistryLite extensionRegistry)
189 return readGroup(Protobuf.getInstance().schemaFor(clazz), extensionRegistry);
192 @SuppressWarnings(
"unchecked")
194 public <T>
T readGroupBySchemaWithCheck(Schema<T> schema, ExtensionRegistryLite extensionRegistry)
197 return readGroup(schema, extensionRegistry);
201 private <T>
T readMessage(Schema<T> schema, ExtensionRegistryLite extensionRegistry)
204 if (
input.recursionDepth >=
input.recursionLimit) {
205 throw InvalidProtocolBufferException.recursionLimitExceeded();
209 final int prevLimit =
input.pushLimit(
size);
212 ++
input.recursionDepth;
213 schema.mergeFrom(
message,
this, extensionRegistry);
215 input.checkLastTagWas(0);
216 --
input.recursionDepth;
218 input.popLimit(prevLimit);
222 private <T>
T readGroup(Schema<T> schema, ExtensionRegistryLite extensionRegistry)
224 int prevEndGroupTag = endGroupTag;
225 endGroupTag = WireFormat.makeTag(WireFormat.getTagFieldNumber(tag),
WIRETYPE_END_GROUP);
230 schema.mergeFrom(
message,
this, extensionRegistry);
233 if (tag != endGroupTag) {
234 throw InvalidProtocolBufferException.parseFailure();
239 endGroupTag = prevEndGroupTag;
244 public ByteString readBytes() throws IOException {
246 return input.readBytes();
250 public int readUInt32() throws IOException {
252 return input.readUInt32();
256 public int readEnum() throws IOException {
258 return input.readEnum();
262 public int readSFixed32() throws IOException {
264 return input.readSFixed32();
268 public long readSFixed64() throws IOException {
270 return input.readSFixed64();
274 public int readSInt32() throws IOException {
276 return input.readSInt32();
280 public long readSInt64() throws IOException {
282 return input.readSInt64();
286 public void readDoubleList(List<Double>
target)
throws IOException {
287 if (
target instanceof DoubleArrayList) {
288 DoubleArrayList plist = (DoubleArrayList)
target;
289 switch (WireFormat.getTagWireType(tag)) {
292 verifyPackedFixed64Length(
bytes);
293 int endPos =
input.getTotalBytesRead() +
bytes;
295 plist.addDouble(
input.readDouble());
296 }
while (
input.getTotalBytesRead() < endPos);
300 plist.addDouble(
input.readDouble());
301 if (
input.isAtEnd()) {
304 int nextTag =
input.readTag();
305 if (nextTag != tag) {
307 this.nextTag = nextTag;
312 throw InvalidProtocolBufferException.invalidWireType();
315 switch (WireFormat.getTagWireType(tag)) {
318 verifyPackedFixed64Length(
bytes);
319 int endPos =
input.getTotalBytesRead() +
bytes;
322 }
while (
input.getTotalBytesRead() < endPos);
327 if (
input.isAtEnd()) {
330 int nextTag =
input.readTag();
331 if (nextTag != tag) {
333 this.nextTag = nextTag;
338 throw InvalidProtocolBufferException.invalidWireType();
344 public void readFloatList(List<Float>
target)
throws IOException {
345 if (
target instanceof FloatArrayList) {
346 FloatArrayList plist = (FloatArrayList)
target;
347 switch (WireFormat.getTagWireType(tag)) {
350 verifyPackedFixed32Length(
bytes);
351 int endPos =
input.getTotalBytesRead() +
bytes;
353 plist.addFloat(
input.readFloat());
354 }
while (
input.getTotalBytesRead() < endPos);
358 plist.addFloat(
input.readFloat());
359 if (
input.isAtEnd()) {
362 int nextTag =
input.readTag();
363 if (nextTag != tag) {
365 this.nextTag = nextTag;
370 throw InvalidProtocolBufferException.invalidWireType();
373 switch (WireFormat.getTagWireType(tag)) {
376 verifyPackedFixed32Length(
bytes);
377 int endPos =
input.getTotalBytesRead() +
bytes;
380 }
while (
input.getTotalBytesRead() < endPos);
385 if (
input.isAtEnd()) {
388 int nextTag =
input.readTag();
389 if (nextTag != tag) {
391 this.nextTag = nextTag;
396 throw InvalidProtocolBufferException.invalidWireType();
402 public void readUInt64List(List<Long>
target)
throws IOException {
403 if (
target instanceof LongArrayList) {
404 LongArrayList plist = (LongArrayList)
target;
405 switch (WireFormat.getTagWireType(tag)) {
408 int endPos =
input.getTotalBytesRead() +
bytes;
410 plist.addLong(
input.readUInt64());
411 }
while (
input.getTotalBytesRead() < endPos);
412 requirePosition(endPos);
416 plist.addLong(
input.readUInt64());
417 if (
input.isAtEnd()) {
420 int nextTag =
input.readTag();
421 if (nextTag != tag) {
423 this.nextTag = nextTag;
428 throw InvalidProtocolBufferException.invalidWireType();
431 switch (WireFormat.getTagWireType(tag)) {
434 int endPos =
input.getTotalBytesRead() +
bytes;
437 }
while (
input.getTotalBytesRead() < endPos);
438 requirePosition(endPos);
443 if (
input.isAtEnd()) {
446 int nextTag =
input.readTag();
447 if (nextTag != tag) {
449 this.nextTag = nextTag;
454 throw InvalidProtocolBufferException.invalidWireType();
460 public void readInt64List(List<Long>
target)
throws IOException {
461 if (
target instanceof LongArrayList) {
462 LongArrayList plist = (LongArrayList)
target;
463 switch (WireFormat.getTagWireType(tag)) {
466 int endPos =
input.getTotalBytesRead() +
bytes;
468 plist.addLong(
input.readInt64());
469 }
while (
input.getTotalBytesRead() < endPos);
470 requirePosition(endPos);
474 plist.addLong(
input.readInt64());
475 if (
input.isAtEnd()) {
478 int nextTag =
input.readTag();
479 if (nextTag != tag) {
481 this.nextTag = nextTag;
486 throw InvalidProtocolBufferException.invalidWireType();
489 switch (WireFormat.getTagWireType(tag)) {
492 int endPos =
input.getTotalBytesRead() +
bytes;
495 }
while (
input.getTotalBytesRead() < endPos);
496 requirePosition(endPos);
501 if (
input.isAtEnd()) {
504 int nextTag =
input.readTag();
505 if (nextTag != tag) {
507 this.nextTag = nextTag;
512 throw InvalidProtocolBufferException.invalidWireType();
518 public void readInt32List(List<Integer>
target)
throws IOException {
519 if (
target instanceof IntArrayList) {
520 IntArrayList plist = (IntArrayList)
target;
521 switch (WireFormat.getTagWireType(tag)) {
524 int endPos =
input.getTotalBytesRead() +
bytes;
526 plist.addInt(
input.readInt32());
527 }
while (
input.getTotalBytesRead() < endPos);
528 requirePosition(endPos);
532 plist.addInt(
input.readInt32());
533 if (
input.isAtEnd()) {
536 int nextTag =
input.readTag();
537 if (nextTag != tag) {
539 this.nextTag = nextTag;
544 throw InvalidProtocolBufferException.invalidWireType();
547 switch (WireFormat.getTagWireType(tag)) {
550 int endPos =
input.getTotalBytesRead() +
bytes;
553 }
while (
input.getTotalBytesRead() < endPos);
554 requirePosition(endPos);
559 if (
input.isAtEnd()) {
562 int nextTag =
input.readTag();
563 if (nextTag != tag) {
565 this.nextTag = nextTag;
570 throw InvalidProtocolBufferException.invalidWireType();
576 public void readFixed64List(List<Long>
target)
throws IOException {
577 if (
target instanceof LongArrayList) {
578 LongArrayList plist = (LongArrayList)
target;
579 switch (WireFormat.getTagWireType(tag)) {
582 verifyPackedFixed64Length(
bytes);
583 int endPos =
input.getTotalBytesRead() +
bytes;
585 plist.addLong(
input.readFixed64());
586 }
while (
input.getTotalBytesRead() < endPos);
590 plist.addLong(
input.readFixed64());
591 if (
input.isAtEnd()) {
594 int nextTag =
input.readTag();
595 if (nextTag != tag) {
597 this.nextTag = nextTag;
602 throw InvalidProtocolBufferException.invalidWireType();
605 switch (WireFormat.getTagWireType(tag)) {
608 verifyPackedFixed64Length(
bytes);
609 int endPos =
input.getTotalBytesRead() +
bytes;
612 }
while (
input.getTotalBytesRead() < endPos);
617 if (
input.isAtEnd()) {
620 int nextTag =
input.readTag();
621 if (nextTag != tag) {
623 this.nextTag = nextTag;
628 throw InvalidProtocolBufferException.invalidWireType();
634 public void readFixed32List(List<Integer>
target)
throws IOException {
635 if (
target instanceof IntArrayList) {
636 IntArrayList plist = (IntArrayList)
target;
637 switch (WireFormat.getTagWireType(tag)) {
640 verifyPackedFixed32Length(
bytes);
641 int endPos =
input.getTotalBytesRead() +
bytes;
643 plist.addInt(
input.readFixed32());
644 }
while (
input.getTotalBytesRead() < endPos);
648 plist.addInt(
input.readFixed32());
649 if (
input.isAtEnd()) {
652 int nextTag =
input.readTag();
653 if (nextTag != tag) {
655 this.nextTag = nextTag;
660 throw InvalidProtocolBufferException.invalidWireType();
663 switch (WireFormat.getTagWireType(tag)) {
666 verifyPackedFixed32Length(
bytes);
667 int endPos =
input.getTotalBytesRead() +
bytes;
670 }
while (
input.getTotalBytesRead() < endPos);
675 if (
input.isAtEnd()) {
678 int nextTag =
input.readTag();
679 if (nextTag != tag) {
681 this.nextTag = nextTag;
686 throw InvalidProtocolBufferException.invalidWireType();
692 public void readBoolList(List<Boolean>
target)
throws IOException {
693 if (
target instanceof BooleanArrayList) {
694 BooleanArrayList plist = (BooleanArrayList)
target;
695 switch (WireFormat.getTagWireType(tag)) {
698 int endPos =
input.getTotalBytesRead() +
bytes;
700 plist.addBoolean(
input.readBool());
701 }
while (
input.getTotalBytesRead() < endPos);
702 requirePosition(endPos);
706 plist.addBoolean(
input.readBool());
707 if (
input.isAtEnd()) {
710 int nextTag =
input.readTag();
711 if (nextTag != tag) {
713 this.nextTag = nextTag;
718 throw InvalidProtocolBufferException.invalidWireType();
721 switch (WireFormat.getTagWireType(tag)) {
724 int endPos =
input.getTotalBytesRead() +
bytes;
727 }
while (
input.getTotalBytesRead() < endPos);
728 requirePosition(endPos);
733 if (
input.isAtEnd()) {
736 int nextTag =
input.readTag();
737 if (nextTag != tag) {
739 this.nextTag = nextTag;
744 throw InvalidProtocolBufferException.invalidWireType();
750 public void readStringList(List<String>
target)
throws IOException {
751 readStringListInternal(
target,
false);
755 public void readStringListRequireUtf8(List<String>
target)
throws IOException {
756 readStringListInternal(
target,
true);
759 public void readStringListInternal(List<String>
target,
boolean requireUtf8)
throws IOException {
761 throw InvalidProtocolBufferException.invalidWireType();
764 if (
target instanceof LazyStringList && !requireUtf8) {
765 LazyStringList lazyList = (LazyStringList)
target;
767 lazyList.add(readBytes());
768 if (
input.isAtEnd()) {
771 int nextTag =
input.readTag();
772 if (nextTag != tag) {
774 this.nextTag = nextTag;
780 target.add(requireUtf8 ? readStringRequireUtf8() : readString());
781 if (
input.isAtEnd()) {
784 int nextTag =
input.readTag();
785 if (nextTag != tag) {
787 this.nextTag = nextTag;
795 public <T>
void readMessageList(
796 List<T>
target, Class<T> targetType, ExtensionRegistryLite extensionRegistry)
798 final Schema<T> schema = Protobuf.getInstance().schemaFor(targetType);
799 readMessageList(
target, schema, extensionRegistry);
803 public <T>
void readMessageList(
804 List<T>
target, Schema<T> schema, ExtensionRegistryLite extensionRegistry)
807 throw InvalidProtocolBufferException.invalidWireType();
809 final int listTag = tag;
811 target.add(readMessage(schema, extensionRegistry));
812 if (
input.isAtEnd() || nextTag != NEXT_TAG_UNSET) {
815 int nextTag =
input.readTag();
816 if (nextTag != listTag) {
818 this.nextTag = nextTag;
825 public <T>
void readGroupList(
826 List<T>
target, Class<T> targetType, ExtensionRegistryLite extensionRegistry)
828 final Schema<T> schema = Protobuf.getInstance().schemaFor(targetType);
829 readGroupList(
target, schema, extensionRegistry);
833 public <T>
void readGroupList(
834 List<T>
target, Schema<T> schema, ExtensionRegistryLite extensionRegistry)
837 throw InvalidProtocolBufferException.invalidWireType();
839 final int listTag = tag;
841 target.add(readGroup(schema, extensionRegistry));
842 if (
input.isAtEnd() || nextTag != NEXT_TAG_UNSET) {
845 int nextTag =
input.readTag();
846 if (nextTag != listTag) {
848 this.nextTag = nextTag;
855 public void readBytesList(List<ByteString>
target)
throws IOException {
857 throw InvalidProtocolBufferException.invalidWireType();
862 if (
input.isAtEnd()) {
865 int nextTag =
input.readTag();
866 if (nextTag != tag) {
868 this.nextTag = nextTag;
875 public void readUInt32List(List<Integer>
target)
throws IOException {
876 if (
target instanceof IntArrayList) {
877 IntArrayList plist = (IntArrayList)
target;
878 switch (WireFormat.getTagWireType(tag)) {
881 int endPos =
input.getTotalBytesRead() +
bytes;
883 plist.addInt(
input.readUInt32());
884 }
while (
input.getTotalBytesRead() < endPos);
885 requirePosition(endPos);
889 plist.addInt(
input.readUInt32());
890 if (
input.isAtEnd()) {
893 int nextTag =
input.readTag();
894 if (nextTag != tag) {
896 this.nextTag = nextTag;
901 throw InvalidProtocolBufferException.invalidWireType();
904 switch (WireFormat.getTagWireType(tag)) {
907 int endPos =
input.getTotalBytesRead() +
bytes;
910 }
while (
input.getTotalBytesRead() < endPos);
911 requirePosition(endPos);
916 if (
input.isAtEnd()) {
919 int nextTag =
input.readTag();
920 if (nextTag != tag) {
922 this.nextTag = nextTag;
927 throw InvalidProtocolBufferException.invalidWireType();
933 public void readEnumList(List<Integer>
target)
throws IOException {
934 if (
target instanceof IntArrayList) {
935 IntArrayList plist = (IntArrayList)
target;
936 switch (WireFormat.getTagWireType(tag)) {
939 int endPos =
input.getTotalBytesRead() +
bytes;
941 plist.addInt(
input.readEnum());
942 }
while (
input.getTotalBytesRead() < endPos);
943 requirePosition(endPos);
947 plist.addInt(
input.readEnum());
948 if (
input.isAtEnd()) {
951 int nextTag =
input.readTag();
952 if (nextTag != tag) {
954 this.nextTag = nextTag;
959 throw InvalidProtocolBufferException.invalidWireType();
962 switch (WireFormat.getTagWireType(tag)) {
965 int endPos =
input.getTotalBytesRead() +
bytes;
968 }
while (
input.getTotalBytesRead() < endPos);
969 requirePosition(endPos);
974 if (
input.isAtEnd()) {
977 int nextTag =
input.readTag();
978 if (nextTag != tag) {
980 this.nextTag = nextTag;
985 throw InvalidProtocolBufferException.invalidWireType();
991 public void readSFixed32List(List<Integer>
target)
throws IOException {
992 if (
target instanceof IntArrayList) {
993 IntArrayList plist = (IntArrayList)
target;
994 switch (WireFormat.getTagWireType(tag)) {
997 verifyPackedFixed32Length(
bytes);
998 int endPos =
input.getTotalBytesRead() +
bytes;
1000 plist.addInt(
input.readSFixed32());
1001 }
while (
input.getTotalBytesRead() < endPos);
1005 plist.addInt(
input.readSFixed32());
1006 if (
input.isAtEnd()) {
1009 int nextTag =
input.readTag();
1010 if (nextTag != tag) {
1012 this.nextTag = nextTag;
1017 throw InvalidProtocolBufferException.invalidWireType();
1020 switch (WireFormat.getTagWireType(tag)) {
1023 verifyPackedFixed32Length(
bytes);
1024 int endPos =
input.getTotalBytesRead() +
bytes;
1027 }
while (
input.getTotalBytesRead() < endPos);
1032 if (
input.isAtEnd()) {
1035 int nextTag =
input.readTag();
1036 if (nextTag != tag) {
1038 this.nextTag = nextTag;
1043 throw InvalidProtocolBufferException.invalidWireType();
1049 public void readSFixed64List(List<Long>
target)
throws IOException {
1050 if (
target instanceof LongArrayList) {
1051 LongArrayList plist = (LongArrayList)
target;
1052 switch (WireFormat.getTagWireType(tag)) {
1055 verifyPackedFixed64Length(
bytes);
1056 int endPos =
input.getTotalBytesRead() +
bytes;
1058 plist.addLong(
input.readSFixed64());
1059 }
while (
input.getTotalBytesRead() < endPos);
1063 plist.addLong(
input.readSFixed64());
1064 if (
input.isAtEnd()) {
1067 int nextTag =
input.readTag();
1068 if (nextTag != tag) {
1070 this.nextTag = nextTag;
1075 throw InvalidProtocolBufferException.invalidWireType();
1078 switch (WireFormat.getTagWireType(tag)) {
1081 verifyPackedFixed64Length(
bytes);
1082 int endPos =
input.getTotalBytesRead() +
bytes;
1085 }
while (
input.getTotalBytesRead() < endPos);
1090 if (
input.isAtEnd()) {
1093 int nextTag =
input.readTag();
1094 if (nextTag != tag) {
1096 this.nextTag = nextTag;
1101 throw InvalidProtocolBufferException.invalidWireType();
1107 public void readSInt32List(List<Integer>
target)
throws IOException {
1108 if (
target instanceof IntArrayList) {
1109 IntArrayList plist = (IntArrayList)
target;
1110 switch (WireFormat.getTagWireType(tag)) {
1113 int endPos =
input.getTotalBytesRead() +
bytes;
1115 plist.addInt(
input.readSInt32());
1116 }
while (
input.getTotalBytesRead() < endPos);
1117 requirePosition(endPos);
1121 plist.addInt(
input.readSInt32());
1122 if (
input.isAtEnd()) {
1125 int nextTag =
input.readTag();
1126 if (nextTag != tag) {
1128 this.nextTag = nextTag;
1133 throw InvalidProtocolBufferException.invalidWireType();
1136 switch (WireFormat.getTagWireType(tag)) {
1139 int endPos =
input.getTotalBytesRead() +
bytes;
1142 }
while (
input.getTotalBytesRead() < endPos);
1143 requirePosition(endPos);
1148 if (
input.isAtEnd()) {
1151 int nextTag =
input.readTag();
1152 if (nextTag != tag) {
1154 this.nextTag = nextTag;
1159 throw InvalidProtocolBufferException.invalidWireType();
1165 public void readSInt64List(List<Long>
target)
throws IOException {
1166 if (
target instanceof LongArrayList) {
1167 LongArrayList plist = (LongArrayList)
target;
1168 switch (WireFormat.getTagWireType(tag)) {
1171 int endPos =
input.getTotalBytesRead() +
bytes;
1173 plist.addLong(
input.readSInt64());
1174 }
while (
input.getTotalBytesRead() < endPos);
1175 requirePosition(endPos);
1179 plist.addLong(
input.readSInt64());
1180 if (
input.isAtEnd()) {
1183 int nextTag =
input.readTag();
1184 if (nextTag != tag) {
1186 this.nextTag = nextTag;
1191 throw InvalidProtocolBufferException.invalidWireType();
1194 switch (WireFormat.getTagWireType(tag)) {
1197 int endPos =
input.getTotalBytesRead() +
bytes;
1200 }
while (
input.getTotalBytesRead() < endPos);
1201 requirePosition(endPos);
1206 if (
input.isAtEnd()) {
1209 int nextTag =
input.readTag();
1210 if (nextTag != tag) {
1212 this.nextTag = nextTag;
1217 throw InvalidProtocolBufferException.invalidWireType();
1222 private void verifyPackedFixed64Length(
int bytes)
throws IOException {
1223 if ((
bytes & FIXED64_MULTIPLE_MASK) != 0) {
1225 throw InvalidProtocolBufferException.parseFailure();
1229 @SuppressWarnings(
"unchecked")
1231 public <K, V>
void readMap(
1234 ExtensionRegistryLite extensionRegistry)
1235 throws IOException {
1238 final int prevLimit =
input.pushLimit(
size);
1243 int number = getFieldNumber();
1260 throw new InvalidProtocolBufferException(
"Unable to parse map entry.");
1264 }
catch (InvalidProtocolBufferException.InvalidWireTypeException ignore) {
1267 throw new InvalidProtocolBufferException(
"Unable to parse map entry.");
1274 input.popLimit(prevLimit);
1278 private Object readField(
1279 WireFormat.FieldType fieldType, Class<?> messageType, ExtensionRegistryLite extensionRegistry)
1280 throws IOException {
1281 switch (fieldType) {
1287 return readDouble();
1291 return readFixed32();
1293 return readFixed64();
1301 return readMessage(messageType, extensionRegistry);
1303 return readSFixed32();
1305 return readSFixed64();
1307 return readSInt32();
1309 return readSInt64();
1311 return readStringRequireUtf8();
1313 return readUInt32();
1315 return readUInt64();
1317 throw new RuntimeException(
"unsupported field type.");
1321 private void verifyPackedFixed32Length(
int bytes)
throws IOException {
1322 if ((
bytes & FIXED32_MULTIPLE_MASK) != 0) {
1324 throw InvalidProtocolBufferException.parseFailure();
1328 private void requirePosition(
int expectedPosition)
throws IOException {
1329 if (
input.getTotalBytesRead() != expectedPosition) {
1330 throw InvalidProtocolBufferException.truncatedMessage();