Index: third_party/protobuf/java/src/main/java/com/google/protobuf/UnknownFieldSet.java |
=================================================================== |
--- third_party/protobuf/java/src/main/java/com/google/protobuf/UnknownFieldSet.java (revision 216642) |
+++ third_party/protobuf/java/src/main/java/com/google/protobuf/UnknownFieldSet.java (working copy) |
@@ -46,7 +46,7 @@ |
* {@code UnknownFieldSet} is used to keep track of fields which were seen when |
* parsing a protocol message but whose field numbers or types are unrecognized. |
* This most frequently occurs when new fields are added to a message type |
- * and then messages containing those feilds are read by old software that was |
+ * and then messages containing those fields are read by old software that was |
* compiled before the new types were added. |
* |
* <p>Every {@link Message} contains an {@code UnknownFieldSet} (and every |
@@ -468,7 +468,7 @@ |
/** |
* Parse a single field from {@code input} and merge it into this set. |
* @param tag The field's tag number, which was already parsed. |
- * @return {@code false} if the tag is an engroup tag. |
+ * @return {@code false} if the tag is an end group tag. |
*/ |
public boolean mergeFieldFrom(final int tag, final CodedInputStream input) |
throws IOException { |
@@ -950,4 +950,29 @@ |
} |
} |
} |
+ |
+ /** |
+ * Parser to implement MessageLite interface. |
+ */ |
+ public static final class Parser extends AbstractParser<UnknownFieldSet> { |
+ public UnknownFieldSet parsePartialFrom( |
+ CodedInputStream input, ExtensionRegistryLite extensionRegistry) |
+ throws InvalidProtocolBufferException { |
+ Builder builder = newBuilder(); |
+ try { |
+ builder.mergeFrom(input); |
+ } catch (InvalidProtocolBufferException e) { |
+ throw e.setUnfinishedMessage(builder.buildPartial()); |
+ } catch (IOException e) { |
+ throw new InvalidProtocolBufferException(e.getMessage()) |
+ .setUnfinishedMessage(builder.buildPartial()); |
+ } |
+ return builder.buildPartial(); |
+ } |
+ } |
+ |
+ private static final Parser PARSER = new Parser(); |
+ public final Parser getParserForType() { |
+ return PARSER; |
+ } |
} |