Package com.google.protobuf
Class UnknownFieldSetLite
java.lang.Object
com.google.protobuf.UnknownFieldSetLite
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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intThe number of elements in the set.private static final UnknownFieldSetLiteprivate booleanIndicates that this object is mutable.private intThe lazily computed serialized size of the set.private static final intprivate Object[]The boxed values of the elements in the set.private int[]The tag numbers for the elements in the set. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateConstructs a mutableUnknownFieldSetLite.privateUnknownFieldSetLite(int count, int[] tags, Object[] objects, boolean isMutable) Constructs theUnknownFieldSetLite. -
Method Summary
Modifier and TypeMethodDescription(package private) voidThrows anUnsupportedOperationExceptionif immutable.private voidensureCapacity(int minCapacity) Ensures that our arrays are long enough to store more metadata.booleanstatic UnknownFieldSetLiteGet an emptyUnknownFieldSetLite.intGet the number of bytes required to encode this set.intGet the number of bytes required to encode this field, including field number, usingMessageSetwire format.inthashCode()private static inthashCode(int[] tags, int count) private static intvoidMarks 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 UnknownFieldSetLiteReturns a new mutable instance.private static booleanobjectsEquals(Object[] objects1, Object[] objects2, int count) (package private) final voidprintWithIndent(StringBuilder buffer, int indent) Prints a String representation of the unknown field set.(package private) voidstoreField(int tag, 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, Object object, Writer writer) voidwriteTo(CodedOutputStream output) Serializes the set and writes it tooutput.voidSerializes the set and writes it towriter.
-
Field Details
-
MIN_CAPACITY
private static final int MIN_CAPACITY- See Also:
-
DEFAULT_INSTANCE
-
count
private int countThe number of elements in the set. -
tags
private int[] tagsThe tag numbers for the elements in the set. -
objects
The boxed values of the elements in the set. -
memoizedSerializedSize
private int memoizedSerializedSizeThe lazily computed serialized size of the set. -
isMutable
private boolean isMutableIndicates that this object is mutable.
-
-
Constructor Details
-
UnknownFieldSetLite
private UnknownFieldSetLite()Constructs a mutableUnknownFieldSetLite. -
UnknownFieldSetLite
Constructs theUnknownFieldSetLite.
-
-
Method Details
-
getDefaultInstance
Get an emptyUnknownFieldSetLite.For use by generated code only.
-
newInstance
Returns a new mutable instance. -
mutableCopyOf
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
Serializes the set and writes it tooutput.For use by generated code only.
- Throws:
IOException
-
writeAsMessageSetTo
Serializes the set and writes it tooutputusingMessageSetwire format.For use by generated code only.
- Throws:
IOException
-
writeAsMessageSetTo
Serializes the set and writes it towriterusingMessageSetwire format.- Throws:
IOException
-
writeTo
Serializes the set and writes it towriter.- Throws:
IOException
-
writeField
- Throws:
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
-
equals
-
hashCode
private static int hashCode(int[] tags, int count) -
hashCode
-
hashCode
public int hashCode() -
printWithIndent
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
-
ensureCapacity
private void ensureCapacity(int minCapacity) Ensures that our arrays are long enough to store more metadata. -
mergeFieldFrom
Parse 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:
IOException
-
mergeVarintField
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
Convenience method for merging a length-delimited field.For use by generated code only.
-
mergeFrom
Parse an entire message frominputand merge its fields into this set.- Throws:
IOException
-
mergeFrom
-