Main Content



Convert data to string in StringConsumer


str = convert(consumer,data)


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 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.



Version History

Introduced in R2018a