Top Description Fields Constructors Methods
com.google.protobuf

public final Class UnknownFieldSetLite

extends Object
Class Inheritance
Imports
java.io.IOException, java.util.Arrays

UnknownFieldSetLite is used to keep 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.

For use by generated code only.

Author
[email protected] (Daniel Weis)

Field Summary

Modifier and TypeField and Description
private int
count

The number of elements in the set.

private static final UnknownFieldSetLite
private boolean
isMutable

Indicates that this object is mutable.

private int
memoizedSerializedSize

The lazily computed serialized size of the set.

private static final int
private Object[]
objects

The boxed values of the elements in the set.

private int[]
tags

The tag numbers for the elements in the set.

Constructor Summary

AccessConstructor and Description
private
UnknownFieldSetLite()

Constructs a mutable UnknownFieldSetLite.

private
UnknownFieldSetLite(int count, int[] tags, Object[] objects, boolean isMutable)

Constructs the UnknownFieldSetLite.

Method Summary

Modifier and TypeMethod and Description
pack-priv void
private void
ensureCapacity()

Ensures that our arrays are long enough to store more metadata.

private static boolean
equals(int[] tags1, int[] tags2, int count)

private static boolean
equals(Object[] objects1, Object[] objects2, int count)

public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public static UnknownFieldSetLite
getDefaultInstance()

Get an empty UnknownFieldSetLite.

public int
getSerializedSize()

Get the number of bytes required to encode this set.

public int
getSerializedSizeAsMessageSet()

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

private static int
hashCode(int[] tags, int count)

private static int
hashCode(Object[] objects, int count)

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
public void
makeImmutable()

Marks this object as immutable.

pack-priv boolean

Returns:

false if the tag is an end group tag.
mergeFieldFrom
(final int
The field's tag number, which was already parsed.
tag
,
final CodedInputStream input)

Parse a single field from input and merge it into this set.

private UnknownFieldSetLite
mergeFrom(final CodedInputStream input)

Parse an entire message from input and merge its fields into this set.

pack-priv UnknownFieldSetLite
mergeLengthDelimitedField(final int fieldNumber, final ByteString value)

Convenience method for merging a length-delimited field.

pack-priv UnknownFieldSetLite
mergeVarintField(int fieldNumber, int value)

Convenience method for merging a new field containing a single varint value.

pack-priv static UnknownFieldSetLite
mutableCopyOf(UnknownFieldSetLite first, UnknownFieldSetLite second)

Returns a mutable UnknownFieldSetLite that is the composite of first and second.

pack-priv static UnknownFieldSetLite
newInstance()

Returns a new mutable instance.

pack-priv final void
printWithIndent(StringBuilder
the buffer to write to
buffer
,
int
the number of spaces the fields should be indented by
indent
)

Prints a String representation of the unknown field set.

pack-priv void
storeField(int tag, Object value)

public void
writeAsMessageSetTo(CodedOutputStream output)

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

public void
writeTo(CodedOutputStream output)

Serializes the set and writes it to output.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

countback to summary
private int count

The number of elements in the set.

DEFAULT_INSTANCEback to summary
private static final UnknownFieldSetLite DEFAULT_INSTANCE
isMutableback to summary
private boolean isMutable

Indicates that this object is mutable.

memoizedSerializedSizeback to summary
private int memoizedSerializedSize

The lazily computed serialized size of the set.

MIN_CAPACITYback to summary
private static final int MIN_CAPACITY
objectsback to summary
private Object[] objects

The boxed values of the elements in the set.

tagsback to summary
private int[] tags

The tag numbers for the elements in the set.

Constructor Detail

UnknownFieldSetLiteback to summary
private UnknownFieldSetLite()

Constructs a mutable UnknownFieldSetLite.

UnknownFieldSetLiteback to summary
private UnknownFieldSetLite(int count, int[] tags, Object[] objects, boolean isMutable)

Constructs the UnknownFieldSetLite.

Method Detail

checkMutableback to summary
pack-priv void checkMutable()

Throws an UnsupportedOperationException if immutable.

ensureCapacityback to summary
private void ensureCapacity()

Ensures that our arrays are long enough to store more metadata.

equalsback to summary
private static boolean equals(int[] tags1, int[] tags2, int count)
equalsback to summary
private static boolean equals(Object[] objects1, Object[] objects2, int count)
equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getDefaultInstanceback to summary
public static UnknownFieldSetLite getDefaultInstance()

Get an empty UnknownFieldSetLite.

For use by generated code only.

getSerializedSizeback to summary
public int getSerializedSize()

Get the number of bytes required to encode this set.

For use by generated code only.

getSerializedSizeAsMessageSetback to summary
public int getSerializedSizeAsMessageSet()

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

hashCodeback to summary
private static int hashCode(int[] tags, int count)
hashCodeback to summary
private static int hashCode(Object[] objects, int count)
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override
makeImmutableback to summary
public void makeImmutable()

Marks this object as immutable.

Future calls to methods that attempt to modify this object will throw.

mergeFieldFromback to summary
pack-priv boolean mergeFieldFrom(final int tag, final CodedInputStream input) throws IOException

Parse a single field from input and merge it into this set.

For use by generated code only.

Parameters
tag:int

The field's tag number, which was already parsed.

Returns:boolean

false if the tag is an end group tag.

mergeFromback to summary
private UnknownFieldSetLite mergeFrom(final CodedInputStream input) throws IOException

Parse an entire message from input and merge its fields into this set.

mergeLengthDelimitedFieldback to summary
pack-priv UnknownFieldSetLite mergeLengthDelimitedField(final int fieldNumber, final ByteString value)

Convenience method for merging a length-delimited field.

For use by generated code only.

mergeVarintFieldback to summary
pack-priv UnknownFieldSetLite mergeVarintField(int fieldNumber, int value)

Convenience method for merging a new field containing a single varint value. This is used in particular when an unknown enum value is encountered.

For use by generated code only.

mutableCopyOfback to summary
pack-priv static UnknownFieldSetLite mutableCopyOf(UnknownFieldSetLite first, UnknownFieldSetLite second)

Returns a mutable UnknownFieldSetLite that is the composite of first and second.

newInstanceback to summary
pack-priv static UnknownFieldSetLite newInstance()

Returns a new mutable instance.

printWithIndentback to summary
pack-priv final void printWithIndent(StringBuilder buffer, int indent)

Prints a String representation of the unknown field set.

For use by generated code only.

Parameters
buffer:StringBuilder

the buffer to write to

indent:int

the number of spaces the fields should be indented by

storeFieldback to summary
pack-priv void storeField(int tag, Object value)
writeAsMessageSetToback to summary
public void writeAsMessageSetTo(CodedOutputStream output) throws IOException

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

For use by generated code only.

writeToback to summary
public void writeTo(CodedOutputStream output) throws IOException

Serializes the set and writes it to output.

For use by generated code only.