Class UnknownFieldSet

java.lang.Object
com.google.protobuf.UnknownFieldSet
All Implemented Interfaces:
com.google.protobuf.MessageLite, com.google.protobuf.MessageLiteOrBuilder

public final class UnknownFieldSet extends Object implements com.google.protobuf.MessageLite
UnknownFieldSet keeps track of fields which were seen when parsing a protocol message but whose field numbers or types are unrecognized. This most frequently occurs when new fields are added to a message type and then messages containing those fields are read by old software that was compiled before the new types were added.

Every Message contains an UnknownFieldSet (and every Message.Builder contains a UnknownFieldSet.Builder).

Most users will never need to use this class.

  • Method Details Link icon

    • newBuilder Link icon

      public static UnknownFieldSet.Builder newBuilder()
    • newBuilder Link icon

      public static UnknownFieldSet.Builder newBuilder(UnknownFieldSet copyFrom)
      Create a new UnknownFieldSet.Builder and initialize it to be a copy of copyFrom.
    • getDefaultInstance Link icon

      public static UnknownFieldSet getDefaultInstance()
      Get an empty UnknownFieldSet.
    • getDefaultInstanceForType Link icon

      public UnknownFieldSet getDefaultInstanceForType()
      Specified by:
      getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuilder
    • equals Link icon

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode Link icon

      public int hashCode()
      Overrides:
      hashCode in class Object
    • isEmpty Link icon

      public boolean isEmpty()
      Whether the field set has no fields.
    • asMap Link icon

      Get a map of fields in the set by number.
    • hasField Link icon

      public boolean hasField(int number)
      Check if the given field number is present in the set.
    • getField Link icon

      public UnknownFieldSet.Field getField(int number)
      Get a field by number. Returns an empty field if not present. Never returns null.
    • writeTo Link icon

      public void writeTo(com.google.protobuf.CodedOutputStream output) throws IOException
      Serializes the set and writes it to output.
      Specified by:
      writeTo in interface com.google.protobuf.MessageLite
      Throws:
      IOException
    • toString Link icon

      public String toString()
      Converts the set to a string in protocol buffer text format. This is just a trivial wrapper around TextFormat.Printer.printToString(UnknownFieldSet).
      Overrides:
      toString in class Object
    • toByteString Link icon

      public com.google.protobuf.ByteString toByteString()
      Serializes the message to a ByteString and returns it. This is just a trivial wrapper around writeTo(CodedOutputStream).
      Specified by:
      toByteString in interface com.google.protobuf.MessageLite
    • toByteArray Link icon

      public byte[] toByteArray()
      Serializes the message to a byte array and returns it. This is just a trivial wrapper around writeTo(CodedOutputStream).
      Specified by:
      toByteArray in interface com.google.protobuf.MessageLite
    • writeTo Link icon

      public void writeTo(OutputStream output) throws IOException
      Serializes the message and writes it to output. This is just a trivial wrapper around writeTo(CodedOutputStream).
      Specified by:
      writeTo in interface com.google.protobuf.MessageLite
      Throws:
      IOException
    • writeDelimitedTo Link icon

      public void writeDelimitedTo(OutputStream output) throws IOException
      Specified by:
      writeDelimitedTo in interface com.google.protobuf.MessageLite
      Throws:
      IOException
    • getSerializedSize Link icon

      public int getSerializedSize()
      Get the number of bytes required to encode this set.
      Specified by:
      getSerializedSize in interface com.google.protobuf.MessageLite
    • writeAsMessageSetTo Link icon

      public void writeAsMessageSetTo(com.google.protobuf.CodedOutputStream output) throws IOException
      Serializes the set and writes it to output using MessageSet wire format.
      Throws:
      IOException
    • getSerializedSizeAsMessageSet Link icon

      public int getSerializedSizeAsMessageSet()
      Get the number of bytes required to encode this set using MessageSet wire format.
    • isInitialized Link icon

      public boolean isInitialized()
      Specified by:
      isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
    • parseFrom Link icon

      public static UnknownFieldSet parseFrom(com.google.protobuf.CodedInputStream input) throws IOException
      Parse an UnknownFieldSet from the given input stream.
      Throws:
      IOException
    • parseFrom Link icon

      public static UnknownFieldSet parseFrom(com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException
      Parse data as an UnknownFieldSet and return it.
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom Link icon

      public static UnknownFieldSet parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException
      Parse data as an UnknownFieldSet and return it.
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom Link icon

      public static UnknownFieldSet parseFrom(InputStream input) throws IOException
      Parse an UnknownFieldSet from input and return it.
      Throws:
      IOException
    • newBuilderForType Link icon

      public UnknownFieldSet.Builder newBuilderForType()
      Specified by:
      newBuilderForType in interface com.google.protobuf.MessageLite
    • toBuilder Link icon

      public UnknownFieldSet.Builder toBuilder()
      Specified by:
      toBuilder in interface com.google.protobuf.MessageLite
    • getParserForType Link icon

      public final UnknownFieldSet.Parser getParserForType()
      Specified by:
      getParserForType in interface com.google.protobuf.MessageLite