|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.google.protobuf.AbstractMessage
public abstract class AbstractMessage
A partial implementation of the Message
interface which implements
as many methods of that interface as possible in terms of other methods.
Nested Class Summary | |
---|---|
static class |
AbstractMessage.Builder<BuilderType extends AbstractMessage.Builder>
A partial implementation of the Message.Builder interface which
implements as many methods of that interface as possible in terms of
other methods. |
Constructor Summary | |
---|---|
AbstractMessage()
|
Method Summary | |
---|---|
boolean |
equals(java.lang.Object other)
Compares the specified object with this message for equality. |
int |
getSerializedSize()
Get the number of bytes required to encode this message. |
int |
hashCode()
Returns the hash code value for this message. |
boolean |
isInitialized()
Returns true if all required fields in the message and all embedded messages are set, false otherwise. |
byte[] |
toByteArray()
Serializes the message to a byte array and returns it. |
ByteString |
toByteString()
Serializes the message to a ByteString and returns it. |
java.lang.String |
toString()
Converts the message to a string in protocol buffer text format. |
void |
writeDelimitedTo(java.io.OutputStream output)
Like Message.writeTo(OutputStream) , but writes the size of the message
as a varint before writing the data. |
void |
writeTo(CodedOutputStream output)
Serializes the message and writes it to output . |
void |
writeTo(java.io.OutputStream output)
Serializes the message and writes it to output . |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.google.protobuf.Message |
---|
getAllFields, getDefaultInstanceForType, getDescriptorForType, getField, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, newBuilderForType, toBuilder |
Constructor Detail |
---|
public AbstractMessage()
Method Detail |
---|
public boolean isInitialized()
Message
isInitialized
in interface Message
public final java.lang.String toString()
Message
TextFormat.printToString(Message)
.
toString
in interface Message
toString
in class java.lang.Object
public void writeTo(CodedOutputStream output) throws java.io.IOException
Message
output
. This does not
flush or close the stream.
writeTo
in interface Message
java.io.IOException
public ByteString toByteString()
Message
ByteString
and returns it. This is
just a trivial wrapper around
Message.writeTo(CodedOutputStream)
.
toByteString
in interface Message
public byte[] toByteArray()
Message
byte
array and returns it. This is
just a trivial wrapper around
Message.writeTo(CodedOutputStream)
.
toByteArray
in interface Message
public void writeTo(java.io.OutputStream output) throws java.io.IOException
Message
output
. This is just a
trivial wrapper around Message.writeTo(CodedOutputStream)
. This does
not flush or close the stream.
NOTE: Protocol Buffers are not self-delimiting. Therefore, if you write
any more data to the stream after the message, you must somehow ensure
that the parser on the receiving end does not interpret this as being
part of the protocol message. This can be done e.g. by writing the size
of the message before the data, then making sure to limit the input to
that size on the receiving end (e.g. by wrapping the InputStream in one
which limits the input). Alternatively, just use
Message.writeDelimitedTo(OutputStream)
.
writeTo
in interface Message
java.io.IOException
public void writeDelimitedTo(java.io.OutputStream output) throws java.io.IOException
Message
Message.writeTo(OutputStream)
, but writes the size of the message
as a varint before writing the data. This allows more data to be written
to the stream after the message without the need to delimit the message
data yourself. Use Message.Builder.mergeDelimitedFrom(InputStream)
(or
the static method YourMessageType.parseDelimitedFrom(InputStream)
)
to parse messages written by this method.
writeDelimitedTo
in interface Message
java.io.IOException
public int getSerializedSize()
Message
getSerializedSize
in interface Message
public boolean equals(java.lang.Object other)
Message
getDescriptorForType()
) and has identical values for
all of its fields.
equals
in interface Message
equals
in class java.lang.Object
other
- object to be compared for equality with this message
public int hashCode()
Message
hashCode
in interface Message
hashCode
in class java.lang.Object
Map.hashCode()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |