Esempio n. 1
0
 /** 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;
 }
Esempio n. 2
0
 /** 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;
 }