Main Content

start

Class: matlab.net.http.io.GenericConsumer
Package: matlab.net.http.io

Start data transfer to GenericConsumer

Syntax

bufsize = start(consumer)

Description

bufsize = start(consumer) returns the maximum buffer size for calls to the putData method.

This method is an abstract method of start that prepares a consumer for receipt of data. If the GenericConsumer object was creating using the putDataHandle argument, then start does nothing and returns []. Otherwise, start determines which ContentConsumer to delegate to, based on the ContentType property and types argument used by the object constructor. If the delegate was specified as a function handle returning a consumer instance, then start calls the function to obtain a delegate consumer instance. start then calls the delegateTo method, passing in the consumer instance, which calls the initialize method in that consumer. If initialize returns false to indicate it does not accept the message, then start tries the next delegate in the list. If a delegate accepts, then it calls start in that delegate. In that case, the caller of start is obligated to send that delegate the data from the message, or terminate the delegate by calling its putData(uint8.empty) method. If all delegates reject the message, then start throws an exception.

When a delegate accepts the message, start saves the delegate instance for that Content-Type. Therefore, if this method is called again with a Content-Type that matches the same types entry, then start uses the same delegate instance.

For more information, see start.

Input Arguments

expand all

Generic consumer, specified as a matlab.net.http.io.GenericConsumer object.

Output Arguments

expand all

Maximum buffer size, returned as double. If the GenericConsumer object was creating using the putDataHandle argument, then start does nothing and returns [].

Attributes

Accessprotected
Introduced in R2018a