Part of twisted.web2.stream View Source View In Hierarchy
Known subclasses: twisted.web2.http._NotifyingProducerStream
Implements interfaces: twisted.internet.interfaces.IConsumer, twisted.web2.stream.IByteStream
Method | __init__ | Undocumented |
Method | read | Read some data. |
Method | split | Split this stream into two, at byte position 'point'. |
Method | close | Called by reader of stream when it is done reading. |
Method | write | The producer will write data by calling this method. |
Method | finish | Called by producer when it is done. |
Method | registerProducer | Register to receive data from a producer. |
Method | unregisterProducer | Stop consuming data from a producer, without disconnecting. |
Read some data.
Returns an object conforming to the buffer interface, or if there is no more data available, returns None. Can also return a Deferred resulting in one of the above.
Errors may be indicated by exception or by a Deferred of a Failure.Split this stream into two, at byte position 'point'.
Returns a tuple of (before, after). After calling split, no other methods should be called on this stream. Doing so will have undefined behavior.
If you cannot implement split easily, you may implement it as:return fallbackSplit(self, point)
Called by producer when it is done.
If the optional failure argument is passed a Failure instance, the stream will return it as errback on next Deferred.Register to receive data from a producer.
This sets self to be a consumer for a producer. When this object runs out of data (as when a send(2) call on a socket succeeds in moving the last data from a userspace buffer into a kernelspace buffer), it will ask the producer to resumeProducing().
For IPullProducer
providers, resumeProducing
will be called once each time data
is required.
IPushProducer
providers, pauseProducing
will be called whenever the write
buffer fills up and resumeProducing
will only be called when
it empties.
Parameters | producer | (type: IProducer
provider
) |
streaming | True if producer provides IPushProducer ,
False if producer provides IPullProducer .
(type: bool
) | |
Returns | None
| |
Raises | RuntimeError | If a producer is already registered. |