Esempio n. 1
0
    def _parse(self, stream, context, path):
        byte = byte2int(stream_read(stream, 1, path))
        if byte & 0x80 == 0:
            return byte

        num_bytes = byte & ~0x80
        encoded_len = stream_read(stream, num_bytes, path)
        num = 0
        for len_byte in iterateints(encoded_len):
            num = num << 8 + len_byte
        return num
 def _parse(self, stream, context, path):
     modulus = self.modulus(context) if callable(self.modulus) else self.modulus
     stream_read(stream, (modulus - len(stream.rbuffer)) % modulus)