public interface UnknownFieldSet
UnknownFieldSet
keeps track of fields seen during parsing of a protocol message but whose field numbers are
not recognized by the user provided marshallers (are never requested by them). This usually occurs when new fields
are added to a message type and then messages containing those fields are read by old versions of software that was
built before the new types were added.
This is also used to handle the case when fields are requested in a different order than they were written to the
stream (lowers performance but still works). In this case all fields that are encountered while parsing the stream up
to the point where the requested field is finally encountered are cached in this data structure.
Modifier and Type | Method and Description |
---|---|
<A> A |
consumeTag(int tag)
Reads and removes a field value from the set.
|
boolean |
hasTag(int tag)
Checks if a tag is present.
|
boolean |
isEmpty()
Checks if there are any fields in this set.
|
void |
putVarintField(int tag,
int value)
Convenience method for merging a new field containing a single varint value.
|
void |
readAllFields(RawProtoStreamReader input)
Parse an entire message from
input and merge its fields into this set. |
boolean |
readSingleField(int tag,
RawProtoStreamReader input)
Parse a single field from
input and merge it into this set. |
void |
writeTo(RawProtoStreamWriter output)
Writes all fields from this set to the
output stream. |
boolean isEmpty()
void readAllFields(RawProtoStreamReader input) throws IOException
input
and merge its fields into this set.IOException
boolean readSingleField(int tag, RawProtoStreamReader input) throws IOException
input
and merge it into this set.tag
- The field's tag number, which was already parsed (tag contains both field id and wire type).false
if the tag is an end group tag.IOException
void putVarintField(int tag, int value)
tag
- the field tag (containing both field id and wire type).void writeTo(RawProtoStreamWriter output) throws IOException
output
stream.IOException
<A> A consumeTag(int tag)
A
- The expected type of the tag value.tag
- the field tag (containing both field id and wire type).boolean hasTag(int tag)
tag
- the field tag (containing both field id and wire type).Copyright © 2016 JBoss, a division of Red Hat. All rights reserved.