def SplitBuffer(buff, index=0, length=None):
 buffer_len = (length or len(buff))
 while (index < buffer_len):
  (encoded_tag, data_index) = ReadTag(buff, index)
  tag_type = (ORD_MAP[encoded_tag[0]] & TAG_TYPE_MASK)
  if (tag_type == WIRETYPE_VARINT):
   (_, new_index) = VarintReader(buff, data_index)
   (yield (encoded_tag, '', buff[data_index:new_index]))
   index = new_index
  elif (tag_type == WIRETYPE_FIXED64):
   (yield (encoded_tag, '', buff[data_index:(data_index + 8)]))
   index = (8 + data_index)
  elif (tag_type == WIRETYPE_FIXED32):
   (yield (encoded_tag, '', buff[data_index:(data_index + 4)]))
   index = (4 + data_index)
  elif (tag_type == WIRETYPE_LENGTH_DELIMITED):
   (length, start) = VarintReader(buff, data_index)
   (yield (encoded_tag, buff[data_index:start], buff[start:(start + length)]))
   index = (start + length)
  else:
   raise rdfvalue.DecodeError('Unexpected Tag.')

def SplitBuffer ( buff , index = 0 , length = None ) : buffer_len = ( length or len ( buff ) ) while ( index < buffer_len ) : ( encoded_tag , data_index ) = ReadTag ( buff , index ) tag_type = ( ORD_MAP [ encoded_tag [ 0 ] ] & TAG_TYPE_MASK ) if ( tag_type == WIRETYPE_VARINT ) : ( _ , new_index ) = VarintReader ( buff , data_index ) ( yield ( encoded_tag , '' , buff [ data_index : new_index ] ) ) index = new_index elif ( tag_type == WIRETYPE_FIXED64 ) : ( yield ( encoded_tag , '' , buff [ data_index : ( data_index + 8 ) ] ) ) index = ( 8 + data_index ) elif ( tag_type == WIRETYPE_FIXED32 ) : ( yield ( encoded_tag , '' , buff [ data_index : ( data_index + 4 ) ] ) ) index = ( 4 + data_index ) elif ( tag_type == WIRETYPE_LENGTH_DELIMITED ) : ( length , start ) = VarintReader ( buff , data_index ) ( yield ( encoded_tag , buff [ data_index : start ] , buff [ start : ( start + length ) ] ) ) index = ( start + length ) else : raise rdfvalue . DecodeError ( 'Unexpected Tag.' )
parses the buffer as a prototypes .