Main Content

convert

Class: matlab.net.http.io.StringConsumer
Namespace: matlab.net.http.io

Convert data to string in StringConsumer

Syntax

str = convert(consumer,data)

Description

str = convert(consumer,data) converts a buffer of data to a string or character vector, str, based on the current values of Charset and TextType. This has the same behavior as putData, but returns the converted string instead of storing it in Response.Body.Data. It does not update CurrentLength.

This is a utility method for the benefit of subclasses that want to interpret the data as a string, and then process the results and store their own data in Response.Body.Data. Subclasses that use this method should not call putData except to pass in empty data at the end of the stream to tell this class that input has ended.

If data ends with a partial multibyte character, that partial character is saved internally and not returned until the next call to convert that provides the remainder of the bytes.

Input Arguments

expand all

Content consumer, specified as a matlab.net.http.io.StringConsumer object.

Buffer of raw data in ResponseMessage, specified as a nonempty uint8 vector, uint8.empty, or [].

Output Arguments

expand all

Text, returned as a string or character vector.

Attributes

Accessprotected

Version History

Introduced in R2018a