Package com.google.protobuf

# Interface MessageLite

All Superinterfaces:
  `MessageLiteOrBuilder`

All Known Subinterfaces:
  `Message`

All Known Implementing Classes:
  `AbstractMessage`, `AbstractMessageLite`, `Any`, `Api`, `BoolValue`, `BytesValue`, `ClientWireProtocol.AttachToQuery`, `ClientWireProtocol.Authenticator`, `ClientWireProtocol.CancelQuery`, `ClientWireProtocol.CancelQueryResponse`, `ClientWireProtocol.ClientConnection`, `ClientWireProtocol.ClientConnection2`, `ClientWireProtocol.ClientConnection2Response`, `ClientWireProtocol.ClientConnectionGCM`, `ClientWireProtocol.ClientConnectionGCM2`, `ClientWireProtocol.ClientConnectionGCM2Response`, `ClientWireProtocol.ClientConnectionGCMResponse`, `ClientWireProtocol.ClientConnectionRefreshSession`, `ClientWireProtocol.ClientConnectionRefreshSessionResponse`, `ClientWireProtocol.ClientConnectionRefreshToken`, `ClientWireProtocol.ClientConnectionRefreshTokenResponse`, `ClientWireProtocol.ClientConnectionResponse`, `ClientWireProtocol.ClientConnectionSecurityToken`, `ClientWireProtocol.ClientConnectionSecurityTokenResponse`, `ClientWireProtocol.ClientConnectionSSO`, `ClientWireProtocol.ClientConnectionSSO2`, `ClientWireProtocol.ClientConnectionSSO2Response`, `ClientWireProtocol.ClientConnectionSSOResponse`, `ClientWireProtocol.CloseConnection`, `ClientWireProtocol.CloseResultSet`, `ClientWireProtocol.ConfirmationResponse`, `ClientWireProtocol.ExecuteExplain`, `ClientWireProtocol.ExecuteExplainForSpark`, `ClientWireProtocol.ExecuteExport`, `ClientWireProtocol.ExecuteExportResponse`, `ClientWireProtocol.ExecuteInlinePlan`, `ClientWireProtocol.ExecutePlan`, `ClientWireProtocol.ExecuteQuery`, `ClientWireProtocol.ExecuteQueryResponse`, `ClientWireProtocol.ExecuteUpdate`, `ClientWireProtocol.ExecuteUpdateResponse`, `ClientWireProtocol.ExplainPipelineRequest`, `ClientWireProtocol.ExplainPipelineResponse`, `ClientWireProtocol.ExplainPlan`, `ClientWireProtocol.ExplainResponseStringPlan`, `ClientWireProtocol.FetchAuthenticators`, `ClientWireProtocol.FetchAuthenticatorsResponse`, `ClientWireProtocol.FetchData`, `ClientWireProtocol.FetchDataResponse`, `ClientWireProtocol.FetchMetadata`, `ClientWireProtocol.FetchMetadataResponse`, `ClientWireProtocol.FetchSystemMetadata`, `ClientWireProtocol.FetchSystemMetadataResponse`, `ClientWireProtocol.FetchUpdateStatus`, `ClientWireProtocol.FetchUpdateStatusResponse`, `ClientWireProtocol.ForceExternal`, `ClientWireProtocol.GetSchema`, `ClientWireProtocol.GetSchemaResponse`, `ClientWireProtocol.KillQuery`, `ClientWireProtocol.KillQueryResponse`, `ClientWireProtocol.ListPlan`, `ClientWireProtocol.ListPlanResponse`, `ClientWireProtocol.OpenIDAuthenticator`, `ClientWireProtocol.QueryConcurrencyResponse`, `ClientWireProtocol.Request`, `ClientWireProtocol.ResultSet`, `ClientWireProtocol.SecondaryInterfaceList`, `ClientWireProtocol.SecurityToken`, `ClientWireProtocol.ServerVersion`, `ClientWireProtocol.SessionInfo`, `ClientWireProtocol.SetParameter`, `ClientWireProtocol.SetParameter.Concurrency`, `ClientWireProtocol.SetParameter.ForceExternal`, `ClientWireProtocol.SetParameter.MaxTempDiskLimit`, `ClientWireProtocol.SetParameter.MemoryTracing`, `ClientWireProtocol.SetParameter.Priority`, `ClientWireProtocol.SetParameter.PriorityAdjustFactor`, `ClientWireProtocol.SetParameter.PriorityAdjustTime`, `ClientWireProtocol.SetParameter.ResultSetColumnLimit`, `ClientWireProtocol.SetParameter.RowLimit`, `ClientWireProtocol.SetParameter.ServiceClassName`, `ClientWireProtocol.SetParameter.TimeLimit`, `ClientWireProtocol.SetSchema`, `ClientWireProtocol.TestConnection`, `DescriptorProtos.DescriptorProto`, `DescriptorProtos.DescriptorProto.ExtensionRange`, `DescriptorProtos.DescriptorProto.ReservedRange`, `DescriptorProtos.EnumDescriptorProto`, `DescriptorProtos.EnumDescriptorProto.EnumReservedRange`, `DescriptorProtos.EnumOptions`, `DescriptorProtos.EnumValueDescriptorProto`, `DescriptorProtos.EnumValueOptions`, `DescriptorProtos.ExtensionRangeOptions`, `DescriptorProtos.ExtensionRangeOptions.Declaration`, `DescriptorProtos.FeatureSet`, `DescriptorProtos.FeatureSetDefaults`, `DescriptorProtos.FeatureSetDefaults.FeatureSetEditionDefault`, `DescriptorProtos.FieldDescriptorProto`, `DescriptorProtos.FieldOptions`, `DescriptorProtos.FieldOptions.EditionDefault`, `DescriptorProtos.FieldOptions.FeatureSupport`, `DescriptorProtos.FileDescriptorProto`, `DescriptorProtos.FileDescriptorSet`, `DescriptorProtos.FileOptions`, `DescriptorProtos.GeneratedCodeInfo`, `DescriptorProtos.GeneratedCodeInfo.Annotation`, `DescriptorProtos.MessageOptions`, `DescriptorProtos.MethodDescriptorProto`, `DescriptorProtos.MethodOptions`, `DescriptorProtos.OneofDescriptorProto`, `DescriptorProtos.OneofOptions`, `DescriptorProtos.ServiceDescriptorProto`, `DescriptorProtos.ServiceOptions`, `DescriptorProtos.SourceCodeInfo`, `DescriptorProtos.SourceCodeInfo.Location`, `DescriptorProtos.UninterpretedOption`, `DescriptorProtos.UninterpretedOption.NamePart`, `DoubleValue`, `Duration`, `DynamicMessage`, `Empty`, `Enum`, `EnumValue`, `Field`, `FieldMask`, `FloatValue`, `GeneratedMessage`, `GeneratedMessage.ExtendableMessage`, `GeneratedMessageLite`, `GeneratedMessageLite.ExtendableMessage`, `GeneratedMessageV3`, `GeneratedMessageV3.ExtendableMessage`, `Int32Value`, `Int64Value`, `JavaFeaturesProto.JavaFeatures`, `ListValue`, `MapEntry`, `Method`, `Mixin`, `Option`, `PluginProtos.CodeGeneratorRequest`, `PluginProtos.CodeGeneratorResponse`, `PluginProtos.CodeGeneratorResponse.File`, `PluginProtos.Version`, `SourceContext`, `StringValue`, `Struct`, `Timestamp`, `Type`, `UInt32Value`, `UInt64Value`, `UnknownFieldSet`, `Value`

@CheckReturnValue public interface MessageLite extends MessageLiteOrBuilder
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 `optimize_for = CODE_SIZE`. This will make the generated code smaller while still supporting all the same features (at the expense of speed). `optimize_for = LITE_RUNTIME` 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.

## Nested Class Summary

Nested Classes
Modifier and Type
Interface
Description
`static interface`
`MessageLite.Builder`
Abstract interface implemented by Protocol Message builders.

## Method Summary

Modifier and Type
Method
Description
`Parser<? extends MessageLite>`
`getParserForType()`
Gets the parser for a message of the same type as this message.
`int`
`getSerializedSize()`
Get the number of bytes required to encode this message.
`MessageLite.Builder`
`newBuilderForType()`
Constructs a new builder for a message of the same type as this message.
`MessageLite.Builder`
`toBuilder()`
Constructs a builder initialized with the current message.
`byte[]`
`toByteArray()`
Serializes the message to a `byte` array and returns it.
`ByteString`
`toByteString()`
Serializes the message to a `ByteString` and returns it.
`void`
`writeDelimitedTo(OutputStream output)`
Like `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(OutputStream output)`
Serializes the message and writes it to `output`.

### Methods inherited from interface com.google.protobuf.MessageLiteOrBuilder

`getDefaultInstanceForType, isInitialized`

## Method Details

### writeTo

void writeTo(CodedOutputStream output) throws IOException
Serializes the message and writes it to `output`. This does not flush or close the stream.

Throws:
  `IOException`

### getSerializedSize

int getSerializedSize()
Get the number of bytes required to encode this message. The result is only computed on the first call and memoized after that. If this message requires more than Integer.MAX_VALUE bytes to encode, the return value will be smaller than the actual number of bytes required and might be negative.

### getParserForType

Parser<? extends MessageLite> getParserForType()
Gets the parser for a message of the same type as this message.

### toByteString

ByteString toByteString()
Serializes the message to a `ByteString` and returns it. This is just a trivial wrapper around `writeTo(CodedOutputStream)`. If this message requires more than Integer.MAX_VALUE bytes to encode, the behavior is unpredictable. It may throw a runtime exception or truncate or slice the data.

### toByteArray

byte[] toByteArray()
Serializes the message to a `byte` array and returns it. This is just a trivial wrapper around `writeTo(CodedOutputStream)`. If this message requires more than Integer.MAX_VALUE bytes to encode, the behavior is unpredictable. It may throw a runtime exception or truncate or slice the data.

### writeTo

void writeTo(OutputStream output) throws IOException
Serializes the message and writes it to `output`. 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, for instance, by writing the size of the message before the data, then making sure to limit the input to that size on the receiving end by wrapping the InputStream in one which limits the input. Alternatively, just use `writeDelimitedTo(OutputStream)`.

Throws:
  `IOException`

### writeDelimitedTo

void 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 `MessageLite.Builder.mergeDelimitedFrom(InputStream)` (or the static method `YourMessageType.parseDelimitedFrom(InputStream)`) to parse messages written by this method.

Throws:
  `IOException`

### newBuilderForType

MessageLite.Builder newBuilderForType()
Constructs a new builder for a message of the same type as this message.

### toBuilder

MessageLite.Builder toBuilder()
Constructs a builder initialized with the current message. Use this to derive a new message from the current one.