def read(self, istream, kmip_version=enums.KMIPVersion.KMIP_1_0):
super(BigInteger, self).read(istream, kmip_version=kmip_version)<EOL>if self.length % <NUM_LIT:8>:<EOL><INDENT>raise exceptions.InvalidPrimitiveLength(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>".format(self.length))<EOL><DEDENT>sign = <NUM_LIT:1><EOL>binary = '<STR_LIT>'<EOL>for _ in range(self.length):<EOL><INDENT>byte = struct.unpack('<STR_LIT>', istream.read(<NUM_LIT:1>))[<NUM_LIT:0>]<EOL>bits = "<STR_LIT>".format(byte)<EOL>pad = len(bits) % <NUM_LIT:8><EOL>if pad:<EOL><INDENT>bits = ('<STR_LIT:0>' * (<NUM_LIT:8> - pad)) + bits<EOL><DEDENT>binary += bits<EOL><DEDENT>if binary[<NUM_LIT:0>] == '<STR_LIT:1>':<EOL><INDENT>sign = -<NUM_LIT:1><EOL>binary = binary.replace('<STR_LIT:1>', '<STR_LIT:i>')<EOL>binary = binary.replace('<STR_LIT:0>', '<STR_LIT:1>')<EOL>binary = binary.replace('<STR_LIT:i>', '<STR_LIT:0>')<EOL>pivot = binary.rfind('<STR_LIT:0>')<EOL>binary = binary[<NUM_LIT:0>:pivot] + '<STR_LIT:1>' + ('<STR_LIT:0>' * len(binary[pivot + <NUM_LIT:1>:]))<EOL><DEDENT>self.value = int(binary, <NUM_LIT:2>) * sign<EOL>
Read the encoding of the BigInteger from the input stream.

Args:
    istream (stream): A buffer containing the encoded bytes of the
        value of a BigInteger. Usually a BytearrayStream object.
        Required.
    kmip_version (KMIPVersion): An enumeration defining the KMIP
        version with which the object will be decoded. Optional,
        defaults to KMIP 1.0.

Raises:
    InvalidPrimitiveLength: if the big integer encoding read in has
        an invalid encoded length.