Package com.google.protobuf
Class UnknownFieldSetLite
- java.lang.Object
-
- com.google.protobuf.UnknownFieldSetLite
-
public final class UnknownFieldSetLite extends java.lang.ObjectUnknownFieldSetLiteis 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.
-
-
Field Summary
Fields Modifier and Type Field Description private intcountThe number of elements in the set.private static UnknownFieldSetLiteDEFAULT_INSTANCEprivate booleanisMutableIndicates that this object is mutable.private intmemoizedSerializedSizeThe lazily computed serialized size of the set.private static intMIN_CAPACITYprivate java.lang.Object[]objectsThe boxed values of the elements in the set.private int[]tagsThe tag numbers for the elements in the set.
-
Constructor Summary
Constructors Modifier Constructor Description privateUnknownFieldSetLite()Constructs a mutableUnknownFieldSetLite.privateUnknownFieldSetLite(int count, int[] tags, java.lang.Object[] objects, boolean isMutable)Constructs theUnknownFieldSetLite.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidcheckMutable()Throws anUnsupportedOperationExceptionif immutable.private voidensureCapacity(int minCapacity)Ensures that our arrays are long enough to store more metadata.booleanequals(java.lang.Object obj)static UnknownFieldSetLitegetDefaultInstance()Get an emptyUnknownFieldSetLite.intgetSerializedSize()Get the number of bytes required to encode this set.intgetSerializedSizeAsMessageSet()Get the number of bytes required to encode this field, including field number, usingMessageSetwire format.inthashCode()private static inthashCode(int[] tags, int count)private static inthashCode(java.lang.Object[] objects, int count)voidmakeImmutable()Marks this object as immutable.(package private) booleanmergeFieldFrom(int tag, CodedInputStream input)Parse a single field frominputand merge it into this set.private UnknownFieldSetLitemergeFrom(CodedInputStream input)Parse an entire message frominputand merge its fields into this set.(package private) UnknownFieldSetLitemergeFrom(UnknownFieldSetLite other)(package private) UnknownFieldSetLitemergeLengthDelimitedField(int fieldNumber, ByteString value)Convenience method for merging a length-delimited field.(package private) UnknownFieldSetLitemergeVarintField(int fieldNumber, int value)Convenience method for merging a new field containing a single varint value.(package private) static UnknownFieldSetLitemutableCopyOf(UnknownFieldSetLite first, UnknownFieldSetLite second)Returns a mutableUnknownFieldSetLitethat is the composite offirstandsecond.(package private) static UnknownFieldSetLitenewInstance()Returns a new mutable instance.private static booleanobjectsEquals(java.lang.Object[] objects1, java.lang.Object[] objects2, int count)(package private) voidprintWithIndent(java.lang.StringBuilder buffer, int indent)Prints a String representation of the unknown field set.(package private) voidstoreField(int tag, java.lang.Object value)private static booleantagsEquals(int[] tags1, int[] tags2, int count)voidwriteAsMessageSetTo(CodedOutputStream output)Serializes the set and writes it tooutputusingMessageSetwire format.(package private) voidwriteAsMessageSetTo(Writer writer)Serializes the set and writes it towriterusingMessageSetwire format.private static voidwriteField(int tag, java.lang.Object object, Writer writer)voidwriteTo(CodedOutputStream output)Serializes the set and writes it tooutput.voidwriteTo(Writer writer)Serializes the set and writes it towriter.
-
-
-
Field Detail
-
MIN_CAPACITY
private static final int MIN_CAPACITY
- See Also:
- Constant Field Values
-
DEFAULT_INSTANCE
private static final UnknownFieldSetLite DEFAULT_INSTANCE
-
count
private int count
The number of elements in the set.
-
tags
private int[] tags
The tag numbers for the elements in the set.
-
objects
private java.lang.Object[] objects
The boxed values of the elements in the set.
-
memoizedSerializedSize
private int memoizedSerializedSize
The lazily computed serialized size of the set.
-
isMutable
private boolean isMutable
Indicates that this object is mutable.
-
-
Method Detail
-
getDefaultInstance
public static UnknownFieldSetLite getDefaultInstance()
Get an emptyUnknownFieldSetLite.For use by generated code only.
-
newInstance
static UnknownFieldSetLite newInstance()
Returns a new mutable instance.
-
mutableCopyOf
static UnknownFieldSetLite mutableCopyOf(UnknownFieldSetLite first, UnknownFieldSetLite second)
Returns a mutableUnknownFieldSetLitethat is the composite offirstandsecond.
-
makeImmutable
public void makeImmutable()
Marks this object as immutable.Future calls to methods that attempt to modify this object will throw.
-
checkMutable
void checkMutable()
Throws anUnsupportedOperationExceptionif immutable.
-
writeTo
public void writeTo(CodedOutputStream output) throws java.io.IOException
Serializes the set and writes it tooutput.For use by generated code only.
- Throws:
java.io.IOException
-
writeAsMessageSetTo
public void writeAsMessageSetTo(CodedOutputStream output) throws java.io.IOException
Serializes the set and writes it tooutputusingMessageSetwire format.For use by generated code only.
- Throws:
java.io.IOException
-
writeAsMessageSetTo
void writeAsMessageSetTo(Writer writer) throws java.io.IOException
Serializes the set and writes it towriterusingMessageSetwire format.- Throws:
java.io.IOException
-
writeTo
public void writeTo(Writer writer) throws java.io.IOException
Serializes the set and writes it towriter.- Throws:
java.io.IOException
-
writeField
private static void writeField(int tag, java.lang.Object object, Writer writer) throws java.io.IOException- Throws:
java.io.IOException
-
getSerializedSizeAsMessageSet
public int getSerializedSizeAsMessageSet()
Get the number of bytes required to encode this field, including field number, usingMessageSetwire format.
-
getSerializedSize
public int getSerializedSize()
Get the number of bytes required to encode this set.For use by generated code only.
-
tagsEquals
private static boolean tagsEquals(int[] tags1, int[] tags2, int count)
-
objectsEquals
private static boolean objectsEquals(java.lang.Object[] objects1, java.lang.Object[] objects2, int count)
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
private static int hashCode(int[] tags, int count)
-
hashCode
private static int hashCode(java.lang.Object[] objects, int count)
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
printWithIndent
final void printWithIndent(java.lang.StringBuilder buffer, int indent)Prints a String representation of the unknown field set.For use by generated code only.
- Parameters:
buffer- the buffer to write toindent- the number of spaces the fields should be indented by
-
storeField
void storeField(int tag, java.lang.Object value)
-
ensureCapacity
private void ensureCapacity(int minCapacity)
Ensures that our arrays are long enough to store more metadata.
-
mergeFieldFrom
boolean mergeFieldFrom(int tag, CodedInputStream input) throws java.io.IOExceptionParse a single field frominputand merge it into this set.For use by generated code only.
- Parameters:
tag- The field's tag number, which was already parsed.- Returns:
falseif the tag is an end group tag.- Throws:
java.io.IOException
-
mergeVarintField
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.
-
mergeLengthDelimitedField
UnknownFieldSetLite mergeLengthDelimitedField(int fieldNumber, ByteString value)
Convenience method for merging a length-delimited field.For use by generated code only.
-
mergeFrom
private UnknownFieldSetLite mergeFrom(CodedInputStream input) throws java.io.IOException
Parse an entire message frominputand merge its fields into this set.- Throws:
java.io.IOException
-
mergeFrom
@CanIgnoreReturnValue UnknownFieldSetLite mergeFrom(UnknownFieldSetLite other)
-
-