Part of twisted.web.client View Source View In Hierarchy
Implements interfaces: twisted.web.iweb.IBodyProducer
FileBodyProducerproduces bytes from an input file object incrementally and writes them to a consumer.
Since file-like objects cannot be read from in an event-driven manner,
instance to schedule reads from the file. This process is also paused and
resumed based on notifications from the
being written to.
The file is closed after it has been read, or if the producer is stopped early.
|Method||stopProducing||Permanently stop writing bytes from the file to the consumer by stopping
|Method||startProducing||Start a cooperative task which will read bytes from the input file and
write them to
|Method||pauseProducing||Temporarily suspend copying bytes from the input file to the consumer by
|Method||resumeProducing||Undo the effects of a previous
|Instance Variable||_inputFile||Any file-like object, bytes read from which will be written to a consumer.|
|Instance Variable||_cooperate||A method like
|Instance Variable||_readSize||The number of bytes to read from
|Method||_determineLength||Determine how many bytes can be read out of
|Method||_writeloop||Return an iterator which reads one chunk of bytes from the input file and writes them to the consumer for each time it is iterated.|
Cooperator.cooperatewhich is used to schedule all reads.
fObj(assuming it is not modified from this point on). If the determination cannot be made, return
CooperativeTaskwhich drives that activity.