|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface Message
Abstract interface implemented by Protocol Message objects.
| Nested Class Summary | |
|---|---|
static interface |
Message.Builder
Abstract interface implemented by Protocol Message builders. |
| Method Summary | |
|---|---|
boolean |
equals(java.lang.Object other)
Compares the specified object with this message for equality. |
java.util.Map<Descriptors.FieldDescriptor,java.lang.Object> |
getAllFields()
Returns a collection of all the fields in this message which are set and their corresponding values. |
Message |
getDefaultInstanceForType()
Get an instance of the type with all fields set to their default values. |
Descriptors.Descriptor |
getDescriptorForType()
Get the message's type's descriptor. |
java.lang.Object |
getField(Descriptors.FieldDescriptor field)
Obtains the value of the given field, or the default value if it is not set. |
java.lang.Object |
getRepeatedField(Descriptors.FieldDescriptor field,
int index)
Gets an element of a repeated field. |
int |
getRepeatedFieldCount(Descriptors.FieldDescriptor field)
Gets the number of elements of a repeated field. |
int |
getSerializedSize()
Get the number of bytes required to encode this message. |
UnknownFieldSet |
getUnknownFields()
Get the UnknownFieldSet for this message. |
boolean |
hasField(Descriptors.FieldDescriptor field)
Returns true if the given field is set. |
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. |
Message.Builder |
newBuilderForType()
Constructs a new builder for a message of the same type as this message. |
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 |
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. |
| Method Detail |
|---|
Descriptors.Descriptor getDescriptorForType()
getDescriptor() method of generated message classes in that
this method is an abstract method of the Message interface
whereas getDescriptor() is a static method of a specific class.
They return the same thing.
Message getDefaultInstanceForType()
getDefaultInstance() method of generated message classes in that
this method is an abstract method of the Message interface
whereas getDefaultInstance() is a static method of a specific
class. They return the same thing.
java.util.Map<Descriptors.FieldDescriptor,java.lang.Object> getAllFields()
getField(Descriptors.FieldDescriptor) for each field. The map
is guaranteed to be a sorted map, so iterating over it will return fields
in order by field number.
boolean hasField(Descriptors.FieldDescriptor field)
java.lang.IllegalArgumentException - The field is a repeated field, or
field.getContainingType() != getDescriptorForType().java.lang.Object getField(Descriptors.FieldDescriptor field)
int getRepeatedFieldCount(Descriptors.FieldDescriptor field)
java.lang.IllegalArgumentException - The field is not a repeated field, or
field.getContainingType() != getDescriptorForType().
java.lang.Object getRepeatedField(Descriptors.FieldDescriptor field,
int index)
java.lang.IllegalArgumentException - The field is not a repeated field, or
field.getContainingType() != getDescriptorForType().UnknownFieldSet getUnknownFields()
UnknownFieldSet for this message.
boolean isInitialized()
void writeTo(CodedOutputStream output)
throws java.io.IOException
output. This does not
flush or close the stream.
java.io.IOExceptionint getSerializedSize()
boolean equals(java.lang.Object other)
getDescriptorForType()) and has identical values for
all of its fields.
equals in class java.lang.Objectother - object to be compared for equality with this message
int hashCode()
hashCode in class java.lang.ObjectMap.hashCode()java.lang.String toString()
TextFormat.printToString(Message).
toString in class java.lang.ObjectByteString toByteString()
ByteString and returns it. This is
just a trivial wrapper around
writeTo(CodedOutputStream).
byte[] toByteArray()
byte array and returns it. This is
just a trivial wrapper around
writeTo(CodedOutputStream).
void writeTo(java.io.OutputStream output)
throws java.io.IOException
output. This is just a
trivial wrapper around writeTo(CodedOutputStream). This does
not flush or close the stream.
java.io.IOExceptionMessage.Builder newBuilderForType()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||