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 marked public.
Since:
1.0
See Also:
  • Field Details

  • Constructor Details

    • UnknownFieldSetImpl

      public UnknownFieldSetImpl()
  • Method Details

    • getField

      private Deque<Object> getField(int tag)
      Get a Deque of values for the given tag. A new Deque is created and added if it does not exist already.
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: UnknownFieldSet
      Checks if there are any fields in this set.
      Specified by:
      isEmpty in interface UnknownFieldSet
    • readAllFields

      public void readAllFields(TagReader input) throws IOException
      Description copied from interface: UnknownFieldSet
      Parse an entire message from input and merge its fields into this set.
      Specified by:
      readAllFields in interface UnknownFieldSet
      Throws:
      IOException
    • readSingleField

      public boolean readSingleField(int tag, TagReader input) throws IOException
      Description copied from interface: UnknownFieldSet
      Parse a single field from input and merge it into this set.
      Specified by:
      readSingleField in interface UnknownFieldSet
      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 interface UnknownFieldSet
      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 the output stream.
      Specified by:
      writeTo in interface UnknownFieldSet
      Throws:
      IOException
    • writeField

      private void writeField(int tag, Deque<?> values, TagWriter output) throws IOException
      Serializes a field, including field number, and writes it to output.
      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 interface UnknownFieldSet
      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 interface UnknownFieldSet
      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 interface Externalizable
      Throws:
      IOException
    • readExternal

      public void readExternal(ObjectInput in) throws IOException
      Specified by:
      readExternal in interface Externalizable
      Throws:
      IOException
    • toString

      public String toString()
      Overrides:
      toString in class Object