merge(into:from:extensions:partial:options:)

Updates the message by reading a single size-delimited message from the given stream. Delimited format allows a single file or stream to contain multiple messages, whereas normally parsing consumes the entire input. A delimited message is a varint encoding the message size followed by a message of exactly that size.

BinaryDelimited.swift:150
static func merge<M>(into message: inout M, from stream: InputStream, extensions: (any ExtensionMap)? = nil, partial: Bool = false, options: BinaryDecodingOptions = BinaryDecodingOptions()) throws where M : Message

Parameters

mergingTo

The message to merge the data into.

from

The InputStream to read the data from. The stream is assumed to be ready to read from.

extensions

An ExtensionMap used to look up and decode any extensions in this message or messages nested within this message’s fields.

partial

If false (the default), this method will check isInitialized after decoding to verify that all required fields are present. If any are missing, this method throws BinaryDelimited/Error/missingRequiredFields.

options

The BinaryDecodingOptions to use.

Throws

Error or SwiftProtobufError if decoding fails, and for some reading errors; or the underlying InputStream.streamError for a stream error.