Class UnknownFieldSet.Field

public static final class UnknownFieldSet.Field

Represents a single field in an UnknownFieldSet.

A Field consists of five lists of values. The lists correspond to the five "wire types" used in the protocol buffer binary format. The wire type of each field can be determined from the encoded form alone, without knowing the field's declared type. So, we are able to parse unknown values at least this far and separate them. Normally, only one of the five lists will contain any values, since it is impossible to define a valid message type that declares two different types for the same field number. However, the code is designed to allow for the case where the same unknown field number is encountered using multiple different wire types.

Field is an immutable class. To construct one, you must use a Builder. See Also: UnknownFieldSet

Inheritance

Object > UnknownFieldSet.Field

Static Methods

getDefaultInstance()

public static UnknownFieldSet.Field getDefaultInstance()

Get an empty Field.

Returns
TypeDescription
UnknownFieldSet.Field

newBuilder()

public static UnknownFieldSet.Field.Builder newBuilder()

Construct a new Builder.

Returns
TypeDescription
UnknownFieldSet.Field.Builder

newBuilder(UnknownFieldSet.Field copyFrom)

public static UnknownFieldSet.Field.Builder newBuilder(UnknownFieldSet.Field copyFrom)

Construct a new Builder and initialize it to a copy of copyFrom.

Parameter
NameDescription
copyFromUnknownFieldSet.Field
Returns
TypeDescription
UnknownFieldSet.Field.Builder

Methods

equals(Object other)

public boolean equals(Object other)
Parameter
NameDescription
otherObject
Returns
TypeDescription
boolean
Overrides

getFixed32List()

public List<Integer> getFixed32List()

Get the list of fixed32 values for this field.

Returns
TypeDescription
List<Integer>

getFixed64List()

public List<Long> getFixed64List()

Get the list of fixed64 values for this field.

Returns
TypeDescription
List<Long>

getGroupList()

public List<UnknownFieldSet> getGroupList()

Get the list of embedded group values for this field. These are represented using UnknownFieldSets rather than Messages since the group's type is presumably unknown.

Returns
TypeDescription
List<UnknownFieldSet>

getLengthDelimitedList()

public List<ByteString> getLengthDelimitedList()

Get the list of length-delimited values for this field.

Returns
TypeDescription
List<ByteString>

getSerializedSize(int fieldNumber)

public int getSerializedSize(int fieldNumber)

Get the number of bytes required to encode this field, including field number.

Parameter
NameDescription
fieldNumberint
Returns
TypeDescription
int

getSerializedSizeAsMessageSetExtension(int fieldNumber)

public int getSerializedSizeAsMessageSetExtension(int fieldNumber)

Get the number of bytes required to encode this field, including field number, using MessageSet wire format.

Parameter
NameDescription
fieldNumberint
Returns
TypeDescription
int

getVarintList()

public List<Long> getVarintList()

Get the list of varint values for this field.

Returns
TypeDescription
List<Long>

hashCode()

public int hashCode()
Returns
TypeDescription
int
Overrides

toByteString(int fieldNumber)

public ByteString toByteString(int fieldNumber)

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

Parameter
NameDescription
fieldNumberint
Returns
TypeDescription
ByteString

writeAsMessageSetExtensionTo(int fieldNumber, CodedOutputStream output)

public void writeAsMessageSetExtensionTo(int fieldNumber, CodedOutputStream output)

Serializes the field, including field number, and writes it to output, using MessageSet wire format.

Parameters
NameDescription
fieldNumberint
outputCodedOutputStream
Exceptions
TypeDescription
IOException

writeTo(int fieldNumber, CodedOutputStream output)

public void writeTo(int fieldNumber, CodedOutputStream output)

Serializes the field, including field number, and writes it to output.

Parameters
NameDescription
fieldNumberint
outputCodedOutputStream
Exceptions
TypeDescription
IOException