Class UnknownFieldSetImpl
java.lang.Object
org.infinispan.protostream.impl.UnknownFieldSetImpl
- All Implemented Interfaces:
Externalizable, Serializable, UnknownFieldSet
UnknownFieldSet implementation. This is not thread-safe. This class should never be directly instantiated by
users even though it is marked public.- Since:
- 1.0
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<A> AconsumeTag(int tag) Reads and removes a field value from the set.getField(int tag) Get a Deque of values for the given tag.booleanhasTag(int tag) Checks if a tag is present.booleanisEmpty()Checks if there are any fields in this set.voidputVarintField(int tag, int value) Convenience method for merging a new field containing a single varint value.voidreadAllFields(TagReader input) Parse an entire message frominputand merge its fields into this set.voidbooleanreadSingleField(int tag, TagReader input) Parse a single field frominputand merge it into this set.toString()voidprivate voidwriteField(int tag, Deque<?> values, TagWriter output) Serializes a field, including field number, and writes it tooutput.voidWrites all fields from this set to theoutputstream.
-
Field Details
-
fields
-
-
Constructor Details
-
UnknownFieldSetImpl
public UnknownFieldSetImpl()
-
-
Method Details
-
getField
-
isEmpty
public boolean isEmpty()Description copied from interface:UnknownFieldSetChecks if there are any fields in this set.- Specified by:
isEmptyin interfaceUnknownFieldSet
-
readAllFields
Description copied from interface:UnknownFieldSetParse an entire message frominputand merge its fields into this set.- Specified by:
readAllFieldsin interfaceUnknownFieldSet- Throws:
IOException
-
readSingleField
Description copied from interface:UnknownFieldSetParse a single field frominputand merge it into this set.- Specified by:
readSingleFieldin interfaceUnknownFieldSet- Parameters:
tag- The field's tag number, which was already parsed (tag contains both field id and wire type).- Returns:
falseif the tag is an end group tag.- Throws:
IOException
-
putVarintField
public void putVarintField(int tag, int value) Description copied from interface:UnknownFieldSetConvenience method for merging a new field containing a single varint value. This is used in particular when an unknown enum value is encountered.- Specified by:
putVarintFieldin interfaceUnknownFieldSet- Parameters:
tag- the field tag (containing both field id and wire type).
-
writeTo
Description copied from interface:UnknownFieldSetWrites all fields from this set to theoutputstream.- Specified by:
writeToin interfaceUnknownFieldSet- Throws:
IOException
-
writeField
Serializes a field, including field number, and writes it tooutput.- Throws:
IOException
-
consumeTag
public <A> A consumeTag(int tag) Description copied from interface:UnknownFieldSetReads and removes a field value from the set. The field is specified as a tag value composed of the numeric id of the field and the wire type. It's possible that the tag has repeated values; in that case the first one is returned.- Specified by:
consumeTagin interfaceUnknownFieldSet- Type Parameters:
A- The expected type of the tag value.- Parameters:
tag- the field tag (containing both field id and wire type).- Returns:
- the first seen value or null if the tag was not found.
-
hasTag
public boolean hasTag(int tag) Description copied from interface:UnknownFieldSetChecks if a tag is present.- Specified by:
hasTagin interfaceUnknownFieldSet- Parameters:
tag- the field tag (containing both field id and wire type).- Returns:
- true if present, false otherwise
-
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOException
-
toString
-