def load(self, input_stream): # Clean up self.__init__() self.input_stream = input_stream # Read the header self.read_header() payload_stream = fileutils.payload(input_stream.name, input_stream.tell()) input_stream.seek(self.file_size) if self.file_size != input_stream.tell(): raise InvalidPackageError() self._read_payload(payload_stream, self.payload_flags)