(self, size)
return result
Read the first 'size' bytes in packet and advance cursor past them.
Read the first 'size' bytes in packet and advance cursor past them.
Read the first size bytes in packet and advance cursor past them .
def read(self, size):
        """Read the first 'size' bytes in packet and advance cursor past them."""
        result = self._data[self._position:(self._position+size)]
        if len(result) != size:
            error = ('Result length not requested length:\n'
                     'Expected=%s.  Actual=%s.  Position: %s.  Data Length: %s'
                     % (size, len(result), self._position, len(self._data)))
            if DEBUG:
                print(error)
                self.dump()
            raise AssertionError(error)
        self._position += size
        return result
def read ( self , size ) : result = self . _data [ self . _position : ( self . _position + size ) ] if len ( result ) != size : error = ( 'Result length not requested length:\n' 'Expected=%s.  Actual=%s.  Position: %s.  Data Length: %s' % ( size , len ( result ) , self . _position , len ( self . _data ) ) ) if DEBUG : print ( error ) self . dump ( ) raise AssertionError ( error ) self . _position += size return result