public abstract class FECCodec
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
MAX_TOTAL_BLOCKS_PER_SEGMENT |
static long |
MIN_MEMORY_ALLOCATION |
Constructor and Description |
---|
FECCodec() |
Modifier and Type | Method and Description |
---|---|
abstract void |
decode(byte[][] dataBlocks,
byte[][] checkBlocks,
boolean[] dataBlocksPresent,
boolean[] checkBlocksPresent,
int blockLength)
Execute a FEC decode.
|
abstract void |
encode(byte[][] dataBlocks,
byte[][] checkBlocks,
boolean[] checkBlocksPresent,
int blockLength)
Execute a FEC encode.
|
abstract int |
getCheckBlocks(int dataBlocks,
InsertContext.CompatibilityMode cmode)
Get the recommended number of check blocks per segment for a given number of data blocks
for a given compatibility mode.
|
static FECCodec |
getInstance(Metadata.SplitfileAlgorithm splitfileType) |
abstract long |
maxMemoryOverheadDecode(int dataBlocks,
int checkBlocks)
Maximum memory usage with the given number of data blocks and check blocks, not including
the blocks themselves.
|
abstract long |
maxMemoryOverheadEncode(int dataBlocks,
int checkBlocks)
Maximum memory usage with the given number of data blocks and check blocks, not including
the blocks themselves.
|
public static final long MIN_MEMORY_ALLOCATION
public static final int MAX_TOTAL_BLOCKS_PER_SEGMENT
public abstract long maxMemoryOverheadDecode(int dataBlocks, int checkBlocks)
public abstract long maxMemoryOverheadEncode(int dataBlocks, int checkBlocks)
public abstract void decode(byte[][] dataBlocks, byte[][] checkBlocks, boolean[] dataBlocksPresent, boolean[] checkBlocksPresent, int blockLength)
dataBlocks
- The byte[]'s for storing the data blocks. Must all be non-null. Which
have valid contents is indicated by dataBlocksPresent. When exit this function, they will
be filled with the data blocks in the correct order.checkBlocks
- The byte[]'s for storing the check blocks. Which have valid contents is
indicated by checkBlocksPresent.dataBlocksPresent
- Indicates which data blocks were present before decoding. (Will
not be changed by this function).checkBlocksPresent
- Indicates which check blocks are present before decoding. (Will
not be changed by this function).blockLength
- The length of any and all blocks. Padding must be handled by the caller
if it is necessary.public abstract void encode(byte[][] dataBlocks, byte[][] checkBlocks, boolean[] checkBlocksPresent, int blockLength)
dataBlocks
- All the data blocks, which all have valid contents.checkBlocks
- The byte[]'s for storing the encoded check blocks. Must all be non-null.checkBlocksPresent
- Indicates which check blocks have already been encoded.public static FECCodec getInstance(Metadata.SplitfileAlgorithm splitfileType)
public abstract int getCheckBlocks(int dataBlocks, InsertContext.CompatibilityMode cmode)
dataBlocks
- The number of data blocks per segment.cmode
- The compatibility mode (so we can exactly mimic the behaviour of older builds
when reinserting files).