def data(self):
    ' The section data from the file.\n\n        Note that data is decompressed if the stored section data is\n        compressed.\n        '
    if (self.header['sh_type'] == 'SHT_NOBITS'):
        return (b'\x00' * self.data_size)
    if self.compressed:
        c_type = self._compression_type
        if (c_type == 'ELFCOMPRESS_ZLIB'):
            hdr_size = self.structs.Elf_Chdr.sizeof()
            self.stream.seek((self['sh_offset'] + hdr_size))
            compressed = self.stream.read((self['sh_size'] - hdr_size))
            decomp = zlib.decompressobj()
            result = decomp.decompress(compressed, self.data_size)
        else:
            raise ELFCompressionError('Unknown compression type: {:#0x}'.format(c_type))
        if (len(result) != self._decompressed_size):
            raise ELFCompressionError('Decompressed data is {} bytes long, should be {} bytes long'.format(len(result), self._decompressed_size))
    else:
        self.stream.seek(self['sh_offset'])
        result = self.stream.read(self._decompressed_size)
    return result
The section data from the file.

Note that data is decompressed if the stored section data is
compressed.
def data(self):
    ' The section data from the file.\n\n        Note that data is decompressed if the stored section data is\n        compressed.\n        '
    if (self.header['sh_type'] == 'SHT_NOBITS'):
        return (b'\x00' * self.data_size)
    if self.compressed:
        c_type = self._compression_type
        if (c_type == 'ELFCOMPRESS_ZLIB'):
            hdr_size = self.structs.Elf_Chdr.sizeof()
            self.stream.seek((self['sh_offset'] + hdr_size))
            compressed = self.stream.read((self['sh_size'] - hdr_size))
            decomp = zlib.decompressobj()
            result = decomp.decompress(compressed, self.data_size)
        else:
            raise ELFCompressionError('Unknown compression type: {:#0x}'.format(c_type))
        if (len(result) != self._decompressed_size):
            raise ELFCompressionError('Decompressed data is {} bytes long, should be {} bytes long'.format(len(result), self._decompressed_size))
    else:
        self.stream.seek(self['sh_offset'])
        result = self.stream.read(self._decompressed_size)
    return result