'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 L{IPullProducer} providers, C{resumeProducing} will be called once
each time data is required.
For L{IPushProducer} providers, C{pauseProducing} will be called
whenever the write buffer fills up and C{resumeProducing} will only be
called when it empties.
@param producer: The producer to register.
@type producer: L{IProducer} provider
@param streaming: L{True} if C{producer} provides L{IPushProducer},
L{False} if C{producer} provides L{IPullProducer}.
@type streaming: L{bool}
@raise RuntimeError: If a producer is already registered.
@return: L{None}'

def registerProducer(self, producer, streaming):

    if self.producer:
        raise ValueError(('registering    producer    %s    before    previous    one    (%s)    was    unregistered' % (producer, self.producer)))
    if (not streaming):
        self.hasStreamingProducer = False
        producer = _PullToPush(producer, self)
        producer.startStreaming()
    else:
        self.hasStreamingProducer = True
    self.producer = producer
    self._producerProducing = True
