parameters: (self, data)
docstring: See IStreamConsumer
docstring_summary: See IStreamConsumer
docstring_tokens: See IStreamConsumer
function: def received(self, data):
          'See IStreamConsumer'
          rm = self.remain
          if rm < 1:
              self.completed = True # Avoid any chance of spinning
              return 0
          datalen = len(data)
          if rm <= datalen:
              self.buf.append(data[:rm])
              self.remain = 0
              self.completed = True
              return rm
          else:
              self.buf.append(data)
              self.remain -= datalen
              return datalen
function_tokens: def received ( self , data ) : rm = self . remain if rm < 1 : self . completed = True # Avoid any chance of spinning return 0 datalen = len ( data ) if rm <= datalen : self . buf . append ( data [ : rm ] ) self . remain = 0 self . completed = True return rm else : self . buf . append ( data ) self . remain -= datalen return datalen