public interface DataEncoder
An encoder receives a data object (source data) and produces encoding packets (as specified in RFC 6330). The source data is divided into a fixed number of source blocks, and each source block can be encoded independently.
An encoder provides a SourceBlockEncoder
object per source block, and each takes care of actually encoding
the source data into encoding packets. These encoder objects are accessed via the method sourceBlock(int)
,
or the method sourceBlockIterable()
.
The number of source blocks, the length of the source data and other parameters are specified as the
FEC parameters. The method fecParameters()
provides the associated parameters to the encoder.
Modifier and Type | Method and Description |
---|---|
long |
dataLength()
Returns the length of the source data, in number of bytes.
|
FECParameters |
fecParameters()
Returns the FEC parameters associated to this encoder.
|
int |
numberOfSourceBlocks()
Returns the number of source blocks into which the source data is partitioned.
|
SourceBlockEncoder |
sourceBlock(int sbn)
Returns an encoder object for the source block with the provided source block number.
|
Iterable<SourceBlockEncoder> |
sourceBlockIterable()
Returns a new iterable over all source block encoders.
|
int |
symbolSize()
Returns the size of a symbol, in number of bytes.
|
FECParameters fecParameters()
long dataLength()
this.fecParameters().dataLength()
.int symbolSize()
this.fecParameters().symbolSize()
.int numberOfSourceBlocks()
this.fecParameters().numberOfSourceBlocks()
.SourceBlockEncoder sourceBlock(int sbn)
Bounds checking - If we have Z
as the number of source blocks into which is divided the
the source data being encoded, then the following must be true, otherwise an IllegalArgumentException
is
thrown:
sbn
≥ 0
sbn
< Z
sbn
- A source block numberIllegalArgumentException
- If the provided source block number is invalidnumberOfSourceBlocks()
Iterable<SourceBlockEncoder> sourceBlockIterable()