webkit
2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
|
Classes | |
interface | Builder |
Public Member Functions | |
void | writeTo (CodedOutputStream output) throws IOException |
int | getSerializedSize () |
Parser<? extends MessageLite > | getParserForType () |
ByteString | toByteString () |
byte [] | toByteArray () |
void | writeTo (OutputStream output) throws IOException |
void | writeDelimitedTo (OutputStream output) throws IOException |
Builder | newBuilderForType () |
Builder | toBuilder () |
Abstract interface implemented by Protocol Message objects.
This interface is implemented by all protocol message objects. Non-lite messages additionally implement the Message interface, which is a subclass of MessageLite. Use MessageLite instead when you only need the subset of features which it supports – namely, nothing that uses descriptors or reflection. You can instruct the protocol compiler to generate classes which implement only MessageLite, not the full Message interface, by adding the follow line to the .proto file:
option optimize_for = LITE_RUNTIME;
This is particularly useful on resource-constrained systems where the full protocol buffers runtime library is too big.
Note that on non-constrained systems (e.g. servers) when you need to link in lots of protocol definitions, a better way to reduce total code footprint is to use
. This will make the generated code smaller while still supporting all the same features (at the expense of speed).
is best when you only have a small number of message types linked into your binary, in which case the size of the protocol buffers runtime itself is the biggest problem.
Parser<? extends MessageLite> com.google.protobuf.MessageLite.getParserForType | ( | ) |
Gets the parser for a message of the same type as this message.
Implemented in com.google.protobuf.UnknownFieldSet, com.google.protobuf.DynamicMessage, com.google.protobuf.MapEntry< K, V >, com.google.protobuf.GeneratedMessage, and com.google.protobuf.Message.
int com.google.protobuf.MessageLite.getSerializedSize | ( | ) |
Get the number of bytes required to encode this message. The result is only computed on the first call and memoized after that.
Implemented in com.google.protobuf.GeneratedMessage, com.google.protobuf.DynamicMessage, com.google.protobuf.UnknownFieldSet, com.google.protobuf.MapEntry< K, V >, and com.google.protobuf.AbstractMessage.
Builder com.google.protobuf.MessageLite.newBuilderForType | ( | ) |
Constructs a new builder for a message of the same type as this message.
Implemented in com.google.protobuf.DynamicMessage, com.google.protobuf.UnknownFieldSet, com.google.protobuf.MapEntry< K, V >, and com.google.protobuf.Message.
Builder com.google.protobuf.MessageLite.toBuilder | ( | ) |
Constructs a builder initialized with the current message. Use this to derive a new message from the current one.
Implemented in com.google.protobuf.DynamicMessage, com.google.protobuf.UnknownFieldSet, com.google.protobuf.MapEntry< K, V >, and com.google.protobuf.Message.
byte [] com.google.protobuf.MessageLite.toByteArray | ( | ) |
Serializes the message to a
array and returns it. This is just a trivial wrapper around writeTo(CodedOutputStream).
Implemented in com.google.protobuf.UnknownFieldSet, and com.google.protobuf.AbstractMessageLite< MessageType extends AbstractMessageLite< MessageType, BuilderType, BuilderType extends AbstractMessageLite.Builder< MessageType, BuilderType >.
ByteString com.google.protobuf.MessageLite.toByteString | ( | ) |
Serializes the message to a
and returns it. This is just a trivial wrapper around writeTo(CodedOutputStream).
Implemented in com.google.protobuf.UnknownFieldSet, and com.google.protobuf.AbstractMessageLite< MessageType extends AbstractMessageLite< MessageType, BuilderType, BuilderType extends AbstractMessageLite.Builder< MessageType, BuilderType >.
void com.google.protobuf.MessageLite.writeDelimitedTo | ( | OutputStream | output | ) | throws IOException |
Like 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 Builder#mergeDelimitedFrom(InputStream) (or the static method
) to parse messages written by this method.
Implemented in com.google.protobuf.UnknownFieldSet, and com.google.protobuf.AbstractMessageLite< MessageType extends AbstractMessageLite< MessageType, BuilderType, BuilderType extends AbstractMessageLite.Builder< MessageType, BuilderType >.
void com.google.protobuf.MessageLite.writeTo | ( | CodedOutputStream | output | ) | throws IOException |
Serializes the message and writes it to
. This does not flush or close the stream.
Implemented in com.google.protobuf.GeneratedMessage, com.google.protobuf.DynamicMessage, com.google.protobuf.UnknownFieldSet, com.google.protobuf.MapEntry< K, V >, and com.google.protobuf.AbstractMessage.
void com.google.protobuf.MessageLite.writeTo | ( | OutputStream | output | ) | throws IOException |
Serializes the message and writes it to
. This is just a trivial wrapper around 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 writeDelimitedTo(OutputStream).
Implemented in com.google.protobuf.UnknownFieldSet, and com.google.protobuf.AbstractMessageLite< MessageType extends AbstractMessageLite< MessageType, BuilderType, BuilderType extends AbstractMessageLite.Builder< MessageType, BuilderType >.