public abstract class MessageNano extends Object
Modifier and Type | Field and Description |
---|---|
protected int |
cachedSize |
Constructor and Description |
---|
MessageNano() |
Modifier and Type | Method and Description |
---|---|
MessageNano |
clone()
Provides support for cloning.
|
protected int |
computeSerializedSize()
Computes the number of bytes required to encode this message.
|
int |
getCachedSize()
Get the number of bytes required to encode this message.
|
int |
getSerializedSize()
Computes the number of bytes required to encode this message.
|
abstract MessageNano |
mergeFrom(CodedInputByteBufferNano input)
Parse
input as a message of this type and merge it with the
message being built. |
static <T extends MessageNano> |
mergeFrom(T msg,
byte[] data)
Parse
data as a message of this type and merge it with the
message being built. |
static <T extends MessageNano> |
mergeFrom(T msg,
byte[] data,
int off,
int len)
Parse
data as a message of this type and merge it with the
message being built. |
static boolean |
messageNanoEquals(MessageNano a,
MessageNano b)
Compares two
MessageNano s and returns true if the message's are the same class and
have serialized form equality (i.e. |
static byte[] |
toByteArray(MessageNano msg)
Serialize to a byte array.
|
static void |
toByteArray(MessageNano msg,
byte[] data,
int offset,
int length)
Serialize to a byte array starting at offset through length.
|
String |
toString()
Returns a string that is (mostly) compatible with ProtoBuffer's TextFormat.
|
void |
writeTo(CodedOutputByteBufferNano output)
Serializes the message and writes it to
output . |
public int getCachedSize()
public int getSerializedSize()
protected int computeSerializedSize()
public void writeTo(CodedOutputByteBufferNano output) throws IOException
output
.output
- the output to receive the serialized form.IOException
- if an error occurred writing to output
.public abstract MessageNano mergeFrom(CodedInputByteBufferNano input) throws IOException
input
as a message of this type and merge it with the
message being built.IOException
public static final byte[] toByteArray(MessageNano msg)
public static final void toByteArray(MessageNano msg, byte[] data, int offset, int length)
public static final <T extends MessageNano> T mergeFrom(T msg, byte[] data) throws InvalidProtocolBufferNanoException
data
as a message of this type and merge it with the
message being built.public static final <T extends MessageNano> T mergeFrom(T msg, byte[] data, int off, int len) throws InvalidProtocolBufferNanoException
data
as a message of this type and merge it with the
message being built.public static final boolean messageNanoEquals(MessageNano a, MessageNano b)
MessageNano
s and returns true if the message's are the same class and
have serialized form equality (i.e. all of the field values are the same).public String toString()
This is implemented using reflection, so it is not especially fast nor is it guaranteed to find all fields if you have method removal turned on for proguard.
public MessageNano clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
Copyright © 2008–2018. All rights reserved.