public final class UnknownFieldSetLite
extends java.lang.Object
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.
Modifier and Type | Field and Description |
---|---|
private int |
count
The number of elements in the set.
|
private static UnknownFieldSetLite |
DEFAULT_INSTANCE |
private boolean |
isMutable
Indicates that this object is mutable.
|
private int |
memoizedSerializedSize
The lazily computed serialized size of the set.
|
private static int |
MIN_CAPACITY |
private java.lang.Object[] |
objects
The boxed values of the elements in the set.
|
private int[] |
tags
The tag numbers for the elements in the set.
|
Modifier | Constructor and Description |
---|---|
private |
UnknownFieldSetLite()
Constructs a mutable
UnknownFieldSetLite . |
private |
UnknownFieldSetLite(int count,
int[] tags,
java.lang.Object[] objects,
boolean isMutable)
Constructs the
UnknownFieldSetLite . |
Modifier and Type | Method and Description |
---|---|
(package private) void |
checkMutable()
Throws an
UnsupportedOperationException if immutable. |
private void |
ensureCapacity()
Ensures that our arrays are long enough to store more metadata.
|
private static boolean |
equals(int[] tags1,
int[] tags2,
int count) |
boolean |
equals(java.lang.Object obj) |
private static boolean |
equals(java.lang.Object[] objects1,
java.lang.Object[] objects2,
int count) |
static UnknownFieldSetLite |
getDefaultInstance()
Get an empty
UnknownFieldSetLite . |
int |
getSerializedSize()
Get the number of bytes required to encode this set.
|
int |
getSerializedSizeAsMessageSet()
Get the number of bytes required to encode this field, including field number, using
MessageSet wire format. |
int |
hashCode() |
private static int |
hashCode(int[] tags,
int count) |
private static int |
hashCode(java.lang.Object[] objects,
int count) |
void |
makeImmutable()
Marks this object as immutable.
|
(package private) boolean |
mergeFieldFrom(int tag,
CodedInputStream input)
Parse a single field from
input and merge it into this set. |
private UnknownFieldSetLite |
mergeFrom(CodedInputStream input)
Parse an entire message from
input and merge its fields into
this set. |
(package private) UnknownFieldSetLite |
mergeLengthDelimitedField(int fieldNumber,
ByteString value)
Convenience method for merging a length-delimited field.
|
(package private) UnknownFieldSetLite |
mergeVarintField(int fieldNumber,
int value)
Convenience method for merging a new field containing a single varint
value.
|
(package private) static UnknownFieldSetLite |
mutableCopyOf(UnknownFieldSetLite first,
UnknownFieldSetLite second)
Returns a mutable
UnknownFieldSetLite that is the composite of first and
second . |
(package private) static UnknownFieldSetLite |
newInstance()
Returns a new mutable instance.
|
(package private) void |
printWithIndent(java.lang.StringBuilder buffer,
int indent)
Prints a String representation of the unknown field set.
|
(package private) void |
storeField(int tag,
java.lang.Object value) |
void |
writeAsMessageSetTo(CodedOutputStream output)
Serializes the set and writes it to
output using MessageSet wire format. |
void |
writeTo(CodedOutputStream output)
Serializes the set and writes it to
output . |
private static final int MIN_CAPACITY
private static final UnknownFieldSetLite DEFAULT_INSTANCE
private int count
private int[] tags
private java.lang.Object[] objects
private int memoizedSerializedSize
private boolean isMutable
private UnknownFieldSetLite()
UnknownFieldSetLite
.private UnknownFieldSetLite(int count, int[] tags, java.lang.Object[] objects, boolean isMutable)
UnknownFieldSetLite
.public static UnknownFieldSetLite getDefaultInstance()
UnknownFieldSetLite
.
For use by generated code only.
static UnknownFieldSetLite newInstance()
static UnknownFieldSetLite mutableCopyOf(UnknownFieldSetLite first, UnknownFieldSetLite second)
UnknownFieldSetLite
that is the composite of first
and
second
.public void makeImmutable()
Future calls to methods that attempt to modify this object will throw.
void checkMutable()
UnsupportedOperationException
if immutable.public void writeTo(CodedOutputStream output) throws java.io.IOException
output
.
For use by generated code only.
java.io.IOException
public void writeAsMessageSetTo(CodedOutputStream output) throws java.io.IOException
output
using MessageSet
wire format.
For use by generated code only.
java.io.IOException
public int getSerializedSizeAsMessageSet()
MessageSet
wire format.public int getSerializedSize()
For use by generated code only.
private static boolean equals(int[] tags1, int[] tags2, int count)
private static boolean equals(java.lang.Object[] objects1, java.lang.Object[] objects2, int count)
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
private static int hashCode(int[] tags, int count)
private static int hashCode(java.lang.Object[] objects, int count)
public int hashCode()
hashCode
in class java.lang.Object
final void printWithIndent(java.lang.StringBuilder buffer, int indent)
For use by generated code only.
buffer
- the buffer to write toindent
- the number of spaces the fields should be indented byvoid storeField(int tag, java.lang.Object value)
private void ensureCapacity()
boolean mergeFieldFrom(int tag, CodedInputStream input) throws java.io.IOException
input
and merge it into this set.
For use by generated code only.
tag
- The field's tag number, which was already parsed.false
if the tag is an end group tag.java.io.IOException
UnknownFieldSetLite mergeVarintField(int fieldNumber, int value)
For use by generated code only.
UnknownFieldSetLite mergeLengthDelimitedField(int fieldNumber, ByteString value)
For use by generated code only.
private UnknownFieldSetLite mergeFrom(CodedInputStream input) throws java.io.IOException
input
and merge its fields into
this set.java.io.IOException