Class UnknownFieldSet (3.19.4)

  public 
  
 final 
  
 class 
 UnknownFieldSet 
  
 implements 
  
 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 Builder ).

Most users will never need to use this class.

Inheritance

Object > UnknownFieldSet

Implements

MessageLite

Static Methods

getDefaultInstance()

  public 
  
 static 
  
 UnknownFieldSet 
  
 getDefaultInstance 
 () 
 

Get an empty UnknownFieldSet .

Returns
Type
Description

newBuilder()

  public 
  
 static 
  
 UnknownFieldSet 
 . 
 Builder 
  
 newBuilder 
 () 
 

Create a new Builder .

Returns
Type
Description

newBuilder(UnknownFieldSet copyFrom)

  public 
  
 static 
  
 UnknownFieldSet 
 . 
 Builder 
  
 newBuilder 
 ( 
 UnknownFieldSet 
  
 copyFrom 
 ) 
 

Create a new Builder and initialize it to be a copy of copyFrom .

Parameter
Name
Description
copyFrom
Returns
Type
Description

parseFrom(byte[] data)

  public 
  
 static 
  
 UnknownFieldSet 
  
 parseFrom 
 ( 
 byte 
 [] 
  
 data 
 ) 
 

Parse data as an UnknownFieldSet and return it.

Parameter
Name
Description
data
byte []
Returns
Type
Description
Exceptions
Type
Description

parseFrom(ByteString data)

  public 
  
 static 
  
 UnknownFieldSet 
  
 parseFrom 
 ( 
 ByteString 
  
 data 
 ) 
 

Parse data as an UnknownFieldSet and return it.

Parameter
Name
Description
data
Returns
Type
Description
Exceptions
Type
Description

parseFrom(CodedInputStream input)

  public 
  
 static 
  
 UnknownFieldSet 
  
 parseFrom 
 ( 
 CodedInputStream 
  
 input 
 ) 
 

Parse an UnknownFieldSet from the given input stream.

Parameter
Name
Description
Returns
Type
Description
Exceptions
Type
Description

parseFrom(InputStream input)

  public 
  
 static 
  
 UnknownFieldSet 
  
 parseFrom 
 ( 
 InputStream 
  
 input 
 ) 
 

Parse an UnknownFieldSet from input and return it.

Parameter
Name
Description
input
Returns
Type
Description
Exceptions
Type
Description

Methods

asMap()

  public 
  
 Map<Integer 
 , 
 UnknownFieldSet 
 . 
 Field 
>  
 asMap 
 () 
 

Get a map of fields in the set by number.

Returns
Type
Description
Map < Integer , Field >

equals(Object other)

  public 
  
 boolean 
  
 equals 
 ( 
 Object 
  
 other 
 ) 
 
Parameter
Name
Description
other
Returns
Type
Description
Overrides

getDefaultInstanceForType()

  public 
  
 UnknownFieldSet 
  
 getDefaultInstanceForType 
 () 
 

Get an instance of the type with no fields set. Because no fields are set, all getters for singular fields will return default values and repeated fields will appear empty. This may or may not be a singleton. This differs from the getDefaultInstance() method of generated message classes in that this method is an abstract method of the MessageLite interface whereas getDefaultInstance() is a static method of a specific class. They return the same thing.

Returns
Type
Description

getField(int number)

  public 
  
 UnknownFieldSet 
 . 
 Field 
  
 getField 
 ( 
 int 
  
 number 
 ) 
 

Get a field by number. Returns an empty field if not present. Never returns null .

Parameter
Name
Description
number
int
Returns
Type
Description

getParserForType()

  public 
  
 final 
  
 UnknownFieldSet 
 . 
 Parser 
  
 getParserForType 
 () 
 

Gets the parser for a message of the same type as this message.

Returns
Type
Description

getSerializedSize()

  public 
  
 int 
  
 getSerializedSize 
 () 
 

Get the number of bytes required to encode this set.

Returns
Type
Description
int

getSerializedSizeAsMessageSet()

  public 
  
 int 
  
 getSerializedSizeAsMessageSet 
 () 
 

Get the number of bytes required to encode this set using MessageSet wire format.

Returns
Type
Description
int

hasField(int number)

  public 
  
 boolean 
  
 hasField 
 ( 
 int 
  
 number 
 ) 
 

Check if the given field number is present in the set.

Parameter
Name
Description
number
int
Returns
Type
Description

hashCode()

  public 
  
 int 
  
 hashCode 
 () 
 
Returns
Type
Description
int
Overrides

isInitialized()

  public 
  
 boolean 
  
 isInitialized 
 () 
 

Returns true if all required fields in the message and all embedded messages are set, false otherwise.

See also: MessageOrBuilder#getInitializationErrorString()

Returns
Type
Description

newBuilderForType()

  public 
  
 UnknownFieldSet 
 . 
 Builder 
  
 newBuilderForType 
 () 
 

Constructs a new builder for a message of the same type as this message.

Returns
Type
Description

toBuilder()

  public 
  
 UnknownFieldSet 
 . 
 Builder 
  
 toBuilder 
 () 
 

Constructs a builder initialized with the current message. Use this to derive a new message from the current one.

Returns
Type
Description

toByteArray()

  public 
  
 byte 
 [] 
  
 toByteArray 
 () 
 

Serializes the message to a byte array and returns it. This is just a trivial wrapper around #writeTo(CodedOutputStream) .

Returns
Type
Description
byte []

toByteString()

  public 
  
 ByteString 
  
 toByteString 
 () 
 

Serializes the message to a ByteString and returns it. This is just a trivial wrapper around #writeTo(CodedOutputStream) .

Returns
Type
Description

toString()

  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) .

Returns
Type
Description
Overrides

writeAsMessageSetTo(CodedOutputStream output)

  public 
  
 void 
  
 writeAsMessageSetTo 
 ( 
 CodedOutputStream 
  
 output 
 ) 
 

Serializes the set and writes it to output using MessageSet wire format.

Parameter
Name
Description
Exceptions
Type
Description

writeDelimitedTo(OutputStream output)

  public 
  
 void 
  
 writeDelimitedTo 
 ( 
 OutputStream 
  
 output 
 ) 
 

Like #writeTo(OutputStream) , but writes the size of the message as a varint before writing the data. This allows more data to be written to the stream after the message without the need to delimit the message data yourself. Use Builder#mergeDelimitedFrom(InputStream) (or the static method YourMessageType.parseDelimitedFrom(InputStream) ) to parse messages written by this method.

Parameter
Name
Description
output
Exceptions
Type
Description

writeTo(CodedOutputStream output)

  public 
  
 void 
  
 writeTo 
 ( 
 CodedOutputStream 
  
 output 
 ) 
 

Serializes the set and writes it to output .

Parameter
Name
Description
Exceptions
Type
Description

writeTo(OutputStream output)

  public 
  
 void 
  
 writeTo 
 ( 
 OutputStream 
  
 output 
 ) 
 

Serializes the message and writes it to output . This is just a trivial wrapper around #writeTo(CodedOutputStream) .

Parameter
Name
Description
output
Exceptions
Type
Description
Create a Mobile Website
View Site in Mobile | Classic
Share by: