(self)
Encapsulate the original data

        Add a header to the data including a CRC32 checksum and the file name.
Encapsulate the original data
Encapsulate the original data
def encapsulate(self):
        """Encapsulate the original data

        Add a header to the data including a CRC32 checksum and the file name.

        """
        orig_data = self.data["original"]
        crc32 = zlib.crc32(orig_data)
        header = struct.pack(MSG_HEADER_FORMAT, self.filename.encode(), crc32)

        self.data['encapsulated'] = header + orig_data

        logger.debug("Checksum: {:d}".format(crc32))
        logger.debug("Packed in data structure with a total of %d bytes" %
                     (len(self.data['encapsulated'])))
def encapsulate ( self ) : orig_data = self . data [ "original" ] crc32 = zlib . crc32 ( orig_data ) header = struct . pack ( MSG_HEADER_FORMAT , self . filename . encode ( ) , crc32 ) self . data [ 'encapsulated' ] = header + orig_data logger . debug ( "Checksum: {:d}" . format ( crc32 ) ) logger . debug ( "Packed in data structure with a total of %d bytes" % ( len ( self . data [ 'encapsulated' ] ) ) )