Class: matlab.net.http.io.ContentConsumer
Package: matlab.net.http.io
Delegate to another consumer
[OK,bufsize] = delegateTo(consumer,delegate,header)
[
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
to
delegate
Set delegate.Header
to the value of
header
Set delegate.MyDelegator
to
consumer
Set delegate
properties, such as
Request
, Response
, and
URI
, to the corresponding consumer
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.
Access | protected |
CurrentDelegate | Header | initialize
| MyDelegator | start