Main Content



Save data for ImageConsumer


[len,stop] = putData(consumer,data)


[len,stop] = putData(consumer,data) processes buffers of data, based on the ContentType property, and returns the result as MATLAB® image data in the Response.Body.Data property. This method is an overridden method of putData. Use this method in subclasses of ImageConsumer.

After all the data in the message, the result is RGB data or a cell array containing image data, colormap, and possible transparency, as documented for the imread function. For more information on image conversion, see the input conversion section of the Data property.

This consumer does not guarantee that Response.Body.Data has a useful result until the end of the data is reached (after putData is passed empty data). Subclasses that override this method, that want to examine the data stream while it is being received, should look at data, not Response.Body.Data.

Subclasses that only want to see the result after conversion to MATLAB image data can examine Response.Body.Data after calling this method with empty data.

After the end of data, this method sets the Info property.

Input Arguments

expand all

Content consumer, specified as a object.

Buffer of raw data in a object, specified as a nonempty uint8 vector, uint8.empty, or []. For more information about these values, see the data input argument for the ContentConsumer.putData method.

Output Arguments

expand all

Length of data processed, returned as double or empty double. For more information, see the size argument in ContentConsumer.putData.

Indicate whether to receive further data from this message, returned as true or false. For more information, see the stop argument in ContentConsumer.putData.



Version History

Introduced in R2018a