class IBodyProducer(IPushProducer): (source)
Known implementations: twisted.web.client.FileBodyProducer
Objects which provide IBodyProducer
write bytes to an object which provides IConsumer
by calling its write method repeatedly.
IBodyProducer
providers may start producing as soon as they have an IConsumer
provider. That is, they should not wait for a resumeProducing call to begin writing data.
IConsumer.unregisterProducer
must not be called. Instead, the Deferred
returned from startProducing must be fired when all bytes have been written.
IConsumer.write
may synchronously invoke any of pauseProducing, resumeProducing, or stopProducing. These methods must be implemented with this in mind.
Present Since | |
9.0 |
Method | startProducing |
Start producing to the given IConsumer provider. |
Method | stopProducing |
No summary |
Attribute | length |
length is a int indicating how many bytes in total this IBodyProducer will write to the consumer or UNKNOWN_LENGTH if this is not known in advance. |
Inherited from IPushProducer
:
Method | pauseProducing |
Pause producing data. |
Method | resumeProducing |
Resume producing data. |
IConsumer
provider.Returns | |
A Deferred which stops production of data when Deferred.cancel is called, and which fires with None when all bytes have been produced or with a Failure if there is any problem before all bytes have been produced. |
IProducer.stopProducing
(stop producing data), make sure the Deferred
returned by startProducing is never fired.int
indicating how many bytes in total this IBodyProducer
will write to the consumer or UNKNOWN_LENGTH
if this is not known in advance.