Main Content

getData

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

Next buffer of data to send in HTTP request message from StringProvider

Syntax

[data,stop] = getData(provider,length)

Description

[data,stop] = getData(provider,length) returns the next buffer of data.

This method is an overridden method of getData. Subclasses that generate their own buffers of data in an overridden getData method, but which want to take advantage of code conversion provide by this method, should set Data to their buffer of data and call this superclass getData method to convert Data to the desired charset. In that call, specify a value of length at least as large as the number of characters in the buffer, or only part of the Data is converted. For example:

      function [data, stop] = getData(obj, length)
          obj.Data = generateNextBufferOfData(obj);
          if isempty(obj.Data)
              stop = true;
          else
              [data, stop] = getData(obj, strlength(obj.Data);
          end
      end

Input Arguments

expand all

Content provider, specified as a matlab.net.http.io.StringProvider object.

Length of data that the provider should return, specified as double. For more information, see the length argument in ContentProvider.getData.

Output Arguments

expand all

Next buffer of data, returned as a uint8 vector or empty. getData normally returns at least length bytes (up to the length of the Data property), as a uint8 vector, by reading up to length characters from Data, but, depending on the characters in Data and Charset, the result might be much longer than length.

Indicate whether to end transmission, returned as a logical that the provider must set.

Attributes

Accesspublic

Version History

Introduced in R2018a

See Also

| |