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
UnknownFieldSet
implementation. This is not thread-safe. This class should never be directly instantiated by users even though it is markedpublic
.- Since:
- 1.0
- Author:
- [email protected]
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description UnknownFieldSetImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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(TagReader input)
Parse an entire message frominput
and merge its fields into this set.void
readExternal(ObjectInput in)
boolean
readSingleField(int tag, TagReader input)
Parse a single field frominput
and merge it into this set.String
toString()
void
writeExternal(ObjectOutput out)
void
writeTo(TagWriter output)
Writes all fields from this set to theoutput
stream.
-
-
-
Method Detail
-
isEmpty
public boolean isEmpty()
Description copied from interface:UnknownFieldSet
Checks if there are any fields in this set.- Specified by:
isEmpty
in interfaceUnknownFieldSet
-
readAllFields
public void readAllFields(TagReader input) throws IOException
Description copied from interface:UnknownFieldSet
Parse an entire message frominput
and merge its fields into this set.- Specified by:
readAllFields
in interfaceUnknownFieldSet
- Throws:
IOException
-
readSingleField
public boolean readSingleField(int tag, TagReader input) throws IOException
Description copied from interface:UnknownFieldSet
Parse a single field frominput
and merge it into this set.- Specified by:
readSingleField
in interfaceUnknownFieldSet
- Parameters:
tag
- The field's tag number, which was already parsed (tag contains both field id and wire type).- Returns:
false
if the tag is an end group tag.- Throws:
IOException
-
putVarintField
public void putVarintField(int tag, int value)
Description copied from interface:UnknownFieldSet
Convenience 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:
putVarintField
in 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:UnknownFieldSet
Writes all fields from this set to theoutput
stream.- Specified by:
writeTo
in interfaceUnknownFieldSet
- Throws:
IOException
-
consumeTag
public <A> A consumeTag(int tag)
Description copied from interface:UnknownFieldSet
Reads 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:
consumeTag
in 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:UnknownFieldSet
Checks if a tag is present.- Specified by:
hasTag
in 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:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
-
-