(self, obj_len, chunks, chunk_ids)
return decoded_obj[:obj_len]
Decode a single FEC object

        Args:
            obj_len   : Length of the original object encoded by the FEC
                        object.
            chunks    : List of FEC chunks.
            chunk_ids : List of ids associated with the list of FEC chunks.

        Note:
            Unlike method decode(), this method processes a single encoded FEC
            object.

        Returns:
            (bytearray) with the decoded (original) data object.
Decode a single FEC object
Decode a single FEC object
def _decode_obj(self, obj_len, chunks, chunk_ids):
        """Decode a single FEC object

        Args:
            obj_len   : Length of the original object encoded by the FEC
                        object.
            chunks    : List of FEC chunks.
            chunk_ids : List of ids associated with the list of FEC chunks.

        Note:
            Unlike method decode(), this method processes a single encoded FEC
            object.

        Returns:
            (bytearray) with the decoded (original) data object.

        """
        # The original (uncoded) object must fit within the maximum number of
        # FEC chunks. Most of the time `obj_len` will be less than the
        # maximum. It only hits the maximum if the FEC overhead is set to zero.
        assert (obj_len <= (MAX_FEC_CHUNKS * CHUNK_SIZE))

        # Number of FEC chunks required to decode the original message:
        n_chunks = ceil(obj_len / CHUNK_SIZE)

        # FEC decoder
        decoder = zfec.Decoder(n_chunks, MAX_FEC_CHUNKS)
        # NOTE: The hard-coded "MAX_FEC_CHUNKS" represents the maximum number
        # of chunks that can be generated. The receiver does not know how many
        # chunks the sender really generated. Nevertheless, it does not need to
        # know, as long as it receives at least n_chunks (any combination of
        # n_chunks). The explanation for this requirement is that the FEC
        # scheme is a maximum distance separable (MDS) erasure code.

        # Decode using the minimum required number of FEC chunks
        decoded_chunks = decoder.decode(chunks[:n_chunks],
                                        chunk_ids[:n_chunks])

        # Concatenate the decoded chunks to form the original object
        decoded_obj = bytearray()
        for chunk in decoded_chunks:
            assert (len(chunk) == CHUNK_SIZE)
            decoded_obj += chunk

        # Remove any zero-padding that may have been applied to the last chunk:
        return decoded_obj[:obj_len]
def _decode_obj ( self , obj_len , chunks , chunk_ids ) : # The original (uncoded) object must fit within the maximum number of # FEC chunks. Most of the time `obj_len` will be less than the # maximum. It only hits the maximum if the FEC overhead is set to zero. assert ( obj_len <= ( MAX_FEC_CHUNKS * CHUNK_SIZE ) ) # Number of FEC chunks required to decode the original message: n_chunks = ceil ( obj_len / CHUNK_SIZE ) # FEC decoder decoder = zfec . Decoder ( n_chunks , MAX_FEC_CHUNKS ) # NOTE: The hard-coded "MAX_FEC_CHUNKS" represents the maximum number # of chunks that can be generated. The receiver does not know how many # chunks the sender really generated. Nevertheless, it does not need to # know, as long as it receives at least n_chunks (any combination of # n_chunks). The explanation for this requirement is that the FEC # scheme is a maximum distance separable (MDS) erasure code. # Decode using the minimum required number of FEC chunks decoded_chunks = decoder . decode ( chunks [ : n_chunks ] , chunk_ids [ : n_chunks ] ) # Concatenate the decoded chunks to form the original object decoded_obj = bytearray ( ) for chunk in decoded_chunks : assert ( len ( chunk ) == CHUNK_SIZE ) decoded_obj += chunk # Remove any zero-padding that may have been applied to the last chunk: return decoded_obj [ : obj_len ]