delegateTo
Class: matlab.net.http.io.ContentConsumer
Namespace: matlab.net.http.io
Delegate to another consumer
Syntax
[OK,bufsize] = delegateTo(consumer,delegate,header)
Description
[
prepares OK
,bufsize
] = delegateTo(consumer
,delegate
,header
)delegate
as a consumer to process subsequent payloads
based on header
. consumer
becomes the
delegator and delegate
becomes the delegate.
To prepare a delegate, delegateTo
sets the following
properties.
Set
consumer.CurrentDelegate
todelegate
Set
delegate.Header
to the value ofheader
Set
delegate.MyDelegator
toconsumer
Set
delegate
properties, such asRequest
,Response
, andURI
, to the correspondingconsumer
properties
delegateTo
then calls the delegate's initialize
method. If initialize
returns true
, indicating that
the delegate accepts the message, then delegateTo
calls the
start
method.
Do not call delegateTo
in a different delegate without telling the
first delegate that the data has ended. To do this, call
delegate.putData(uint8.empty)
.
The delegate's initialize
method sets OK
and its
start
method sets bufsize
.
bufsize
is valid only if OK
is
true
. If OK
is false
,
then the start
method was not called and this consumer should not
invoke putData
in that delegate.
Input Arguments
Output Arguments
Attributes
Access | protected |
Version History
Introduced in R2018a
See Also
Header | CurrentDelegate | MyDelegator | initialize
| start