public static final class UnknownFieldSet.Builder extends Objectimplements MessageLite .Builder
UnknownFieldSets.
Note that this class maintains UnknownFieldSet.Field.Builders for all fields in the set. Thus, adding one element to an existing UnknownFieldSet.Field does not require making a copy. This is important for efficient parsing of unknown repeated fields. However, it implies that UnknownFieldSet.Fields cannot be constructed independently, nor can two UnknownFieldSets share the same Field object.
Use UnknownFieldSet to construct a Builder.
| Modifier and Type | Method and Description |
|---|---|
UnknownFieldSet |
addField(int number, UnknownFieldSet
Add a field to the
UnknownFieldSet.
|
Map |
asMap()
Get all present
Fields as an immutable
Map.
|
UnknownFieldSet |
build()
Build the
UnknownFieldSet and return it.
|
UnknownFieldSet |
buildPartial()
Like
MessageLite, but does not throw an exception if the message is missing required fields.
|
UnknownFieldSet |
clear()
Reset the builder to an empty set.
|
UnknownFieldSet |
clearField(int number)
Clear fields from the set with a given field number.
|
UnknownFieldSet |
clone()
Clones the Builder.
|
UnknownFieldSet |
getDefaultInstanceForType()
Get an instance of the type with no fields set.
|
boolean |
hasField(int number)
Check if the given field number is present in the set.
|
boolean |
isInitialized()
Returns true if all required fields in the message and all embedded messages are set, false otherwise.
|
boolean |
mergeDelimitedFrom(InputStream
Like
MessageLite, but does not read until EOF.
|
boolean |
mergeDelimitedFrom(InputStream
Like
MessageLite but supporting extensions.
|
UnknownFieldSet |
mergeField(int number, UnknownFieldSet
Add a field to the
UnknownFieldSet.
|
boolean |
mergeFieldFrom(int tag, CodedInputStream
Parse a single field from
input and merge it into this set.
|
UnknownFieldSet |
mergeFrom(byte[] data)
Parse
data as an
UnknownFieldSet and merge it with the set being built.
|
UnknownFieldSet |
mergeFrom(byte[] data, ExtensionRegistryLite
Parse
data as a message of this type and merge it with the message being built.
|
UnknownFieldSet |
mergeFrom(byte[] data, int off, int len)
Parse
data as a message of this type and merge it with the message being built.
|
UnknownFieldSet |
mergeFrom(byte[] data, int off, int len, ExtensionRegistryLite
Parse
data as a message of this type and merge it with the message being built.
|
UnknownFieldSet |
mergeFrom(ByteString
Parse
data as an
UnknownFieldSet and merge it with the set being built.
|
UnknownFieldSet |
mergeFrom(ByteString
Parse
data as a message of this type and merge it with the message being built.
|
UnknownFieldSet |
mergeFrom(CodedInputStream
Parse an entire message from
input and merge its fields into this set.
|
UnknownFieldSet |
mergeFrom(CodedInputStream
Like
MessageLite, but also parses extensions.
|
UnknownFieldSet |
mergeFrom(InputStream
Parse an
UnknownFieldSet from
input and merge it with the set being built.
|
UnknownFieldSet |
mergeFrom(InputStream
Parse a message of this type from
input and merge it with the message being built.
|
UnknownFieldSet |
mergeFrom(UnknownFieldSet
Merge the fields from
other into this set.
|
UnknownFieldSet |
mergeVarintField(int number, int value)
Convenience method for merging a new field containing a single varint value.
|
public UnknownFieldSetbuild()
UnknownFieldSet and return it.
Once build() has been called, the Builder will no longer be usable. Calling any method after build() will result in undefined behavior and can cause a NullPointerException to be thrown.
public UnknownFieldSetbuildPartial()
MessageLite.Builder
MessageLite.Builder.build() , but does not throw an exception if the message is missing required fields. Instead, a partial message is returned. Subsequent changes to the Builder will not affect the returned message.
public UnknownFieldSet.Builder clone()
MessageLite.Builder
clone in interface
MessageLite.Builder
clone in class
Object
Object.clone()
public UnknownFieldSetgetDefaultInstanceForType()
MessageLiteOrBuilder
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.
public UnknownFieldSet.Builder clear()
public UnknownFieldSet.Builder clearField(int number)
public UnknownFieldSet.Builder mergeFrom(UnknownFieldSet other)
other into this set. If a field number exists in both sets,
other's values for that field will be appended to the values in this set.
public UnknownFieldSet.Builder mergeField(int number, UnknownFieldSet .Field field)
UnknownFieldSet. If a field with the same number already exists, the two are merged.
public UnknownFieldSet.Builder mergeVarintField(int number, int value)
public boolean hasField(int number)
public UnknownFieldSet.Builder addField(int number, UnknownFieldSet .Field field)
UnknownFieldSet. If a field with the same number already exists, it is removed.
public Map<Integer ,UnknownFieldSet .Field > asMap()
Fields as an immutable
Map. If more fields are added, the changes may or may not be reflected in this map.
public UnknownFieldSet.Builder mergeFrom(CodedInputStream input) throws IOException
input and merge its fields into this set.
mergeFrom in interface
MessageLite.Builder
IOException
public boolean mergeFieldFrom(int tag,
CodedInputStream input)
throws IOException
input and merge it into this set.
tag - The field's tag number, which was already parsed.
false if the tag is an end group tag.
IOException
public UnknownFieldSet.Builder mergeFrom(ByteString data) throws InvalidProtocolBufferException
data as an
UnknownFieldSet and merge it with the set being built. This is just a small wrapper around
mergeFrom(CodedInputStream).
mergeFrom in interface
MessageLite.Builder
InvalidProtocolBufferException
public UnknownFieldSet.Builder mergeFrom(byte[] data) throws InvalidProtocolBufferException
data as an
UnknownFieldSet and merge it with the set being built. This is just a small wrapper around
mergeFrom(CodedInputStream).
mergeFrom in interface
MessageLite.Builder
InvalidProtocolBufferException
public UnknownFieldSet.Builder mergeFrom(InputStream input) throws IOException
UnknownFieldSet from
input and merge it with the set being built. This is just a small wrapper around
mergeFrom(CodedInputStream).
mergeFrom in interface
MessageLite.Builder
IOException
public boolean mergeDelimitedFrom(InputStreaminput) throws IOException
MessageLite.Builder
MessageLite.Builder.mergeFrom(InputStream) , but does not read until EOF. Instead, the size of the message (encoded as a varint) is read first, then the message data. Use
MessageLite.writeDelimitedTo(OutputStream) to write messages in this format.
mergeDelimitedFrom in interface
MessageLite.Builder
IOException
public boolean mergeDelimitedFrom(InputStreaminput, ExtensionRegistryLite extensionRegistry) throws IOException
MessageLite.Builder
MessageLite.Builder.mergeDelimitedFrom(InputStream) but supporting extensions.
mergeDelimitedFrom in interface
MessageLite.Builder
IOException
public UnknownFieldSet.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws IOException
MessageLite.Builder
MessageLite.Builder.mergeFrom(CodedInputStream) , but also parses extensions. The extensions that you want to be able to parse must be registered in
extensionRegistry. Extensions not in the registry will be treated as unknown fields.
mergeFrom in interface
MessageLite.Builder
IOException
public UnknownFieldSet.Builder mergeFrom(ByteString data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
MessageLite.Builder
data as a message of this type and merge it with the message being built. This is just a small wrapper around
MessageLite.Builder.mergeFrom(CodedInputStream,ExtensionRegistryLite) .
mergeFrom in interface
MessageLite.Builder
InvalidProtocolBufferException
public UnknownFieldSet.Builder mergeFrom(byte[] data, int off, int len) throws InvalidProtocolBufferException
MessageLite.Builder
data as a message of this type and merge it with the message being built. This is just a small wrapper around
MessageLite.Builder.mergeFrom(CodedInputStream) .
mergeFrom in interface
MessageLite.Builder
InvalidProtocolBufferException
public UnknownFieldSet.Builder mergeFrom(byte[] data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
MessageLite.Builder
data as a message of this type and merge it with the message being built. This is just a small wrapper around
MessageLite.Builder.mergeFrom(CodedInputStream,ExtensionRegistryLite) .
mergeFrom in interface
MessageLite.Builder
InvalidProtocolBufferException
public UnknownFieldSet.Builder mergeFrom(byte[] data, int off, int len, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
MessageLite.Builder
data as a message of this type and merge it with the message being built. This is just a small wrapper around
MessageLite.Builder.mergeFrom(CodedInputStream,ExtensionRegistryLite) .
mergeFrom in interface
MessageLite.Builder
InvalidProtocolBufferException
public UnknownFieldSet.Builder mergeFrom(InputStream input, ExtensionRegistryLite extensionRegistry) throws IOException
MessageLite.Builder
input and merge it with the message being built. This is just a small wrapper around
MessageLite.Builder.mergeFrom(CodedInputStream,ExtensionRegistryLite) .
mergeFrom in interface
MessageLite.Builder
IOException
public boolean isInitialized()
MessageLiteOrBuilder