matlab.net.http.io.ContentProvider.getData - Next buffer of data to send in HTTP request message from
ContentProvider - MATLAB ([original](https://in.mathworks.com/help/matlab/ref/matlab.net.http.io.contentprovider.getdata.html)) ([raw](?raw))
Class: matlab.net.http.io.ContentProvider
Namespace: matlab.net.http.io
Next buffer of data to send in HTTP request message from ContentProvider
Syntax
[data,stop] = getData(provider,length)
Description
[[data](#mw%5F4d501f4a-4cbb-4cfa-a95e-7b789e9d2117),[stop](#mw%5Fadbb002e-01f4-49af-a392-e6bc6e4eb589)] = getData([provider](#d126e828406),[length](#mw%5Fba967835-357c-4d9c-b9ba-4b520a58c0c2))
returns a buffer of data to send in an HTTP request message.
MATLABĀ® calls this method multiple times duringRequestMessage.send
, after calling start
, and sends each buffer of data
to the server immediately. If the message is chunked (for example, expectedContentLength
returned empty and there is no Content-Length field in the message), then the size of the chunk is the length ofdata
.
Input Arguments
Content provider, specified as amatlab.net.http.io.ContentProvider
object.
Length of data that the provider should return for optimum interactive behavior, specified as double.
The value is a suggested length based on the value ofpreferredBufferSize
, if specified, and the internal buffer sizes. The provider can, however, return more or fewer bytes, and if your provider wants to send chunks of specific sizes, it can ignorelength
. MATLAB does not guarantee that any specific value oflength
is specified, but it always is a finite number greater than zero. Returning a large buffer ofdata might cause MATLAB to block for a considerable time while sending the data, during which you cannot interrupt the operation usingCtrl+C. This might not be an issue for non-interactive applications, where larger buffers are efficient.
Output Arguments
Next buffer of data, returned as a uint8
vector or empty. If data
is empty and stop is not set, then MATLAB calls this method repeatedly to get more data (after a small delay). To end the message, return stop=true
. However, you can also throw an exception to abort the message, which is returned to the caller of RequestMessage.send
.
If the Content-Length header field was included in the message header or returned by expectedContentLength
(that is, the message is not being sent using chunked transfer coding), then the total number of bytes returned in data
over multiple calls, ending withstop=true
, must be equal to that number. Ifstop=true
is returned prematurely, or the total amount of data
returned is greater than that number, then MATLAB throws an exception and closes the connection.
Indicate whether to end transmission, returned as a logical that the provider must set. If false
, then MATLAB calls this getData
again to get more data when it is ready to send the next buffer. If true
, then this indicates that the provider has no more data to send, beyond what is returned in data, and tells MATLAB to end the message. This is the normal way to end theRequestMessage
and prepare MATLAB to receive a ResponseMessage
.
Attributes
Version History
Introduced in R2018a