Package org.infinispan.protostream.impl
Class UnknownFieldSetImpl
- java.lang.Object
-
- org.infinispan.protostream.impl.UnknownFieldSetImpl
-
- All Implemented Interfaces:
Externalizable,Serializable,UnknownFieldSet
public final class UnknownFieldSetImpl extends Object implements UnknownFieldSet, Externalizable
UnknownFieldSetimplementation. This is not thread-safe. This class should never be directly instantiated by users even though it is markedpublic.- Since:
- 1.0
- Author:
- anistor@redhat.com
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description UnknownFieldSetImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <A> AconsumeTag(int tag)Reads and removes a field value from the set.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.voidreadExternal(ObjectInput in)booleanreadSingleField(int tag, TagReader input)Parse a single field frominputand merge it into this set.StringtoString()voidwriteExternal(ObjectOutput out)voidwriteTo(TagWriter output)Writes all fields from this set to theoutputstream.
-
-
-
Method Detail
-
isEmpty
public boolean isEmpty()
Description copied from interface:UnknownFieldSetChecks if there are any fields in this set.- Specified by:
isEmptyin interfaceUnknownFieldSet
-
readAllFields
public void readAllFields(TagReader input) throws IOException
Description copied from interface:UnknownFieldSetParse an entire message frominputand merge its fields into this set.- Specified by:
readAllFieldsin interfaceUnknownFieldSet- Throws:
IOException
-
readSingleField
public boolean readSingleField(int tag, TagReader input) throws IOExceptionDescription 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
public void writeTo(TagWriter output) throws IOException
Description copied from interface:UnknownFieldSetWrites all fields from this set to theoutputstream.- Specified by:
writeToin interfaceUnknownFieldSet- 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
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOException
-
-