public class OnionFECCodec extends FECCodec
MAX_TOTAL_BLOCKS_PER_SEGMENT, MIN_MEMORY_ALLOCATION
Constructor and Description |
---|
OnionFECCodec() |
Modifier and Type | Method and Description |
---|---|
void |
decode(byte[][] dataBlocks,
byte[][] checkBlocks,
boolean[] dataBlocksPresent,
boolean[] checkBlocksPresent,
int blockLength)
Execute a FEC decode.
|
void |
encode(byte[][] dataBlocks,
byte[][] checkBlocks,
boolean[] checkBlocksPresent,
int blockLength)
Execute a FEC encode.
|
int |
getCheckBlocks(int dataBlocks,
InsertContext.CompatibilityMode compatibilityMode)
Get the recommended number of check blocks per segment for a given number of data blocks
for a given compatibility mode.
|
long |
maxMemoryOverheadDecode(int dataBlocks,
int checkBlocks)
Maximum memory usage with the given number of data blocks and check blocks, not including
the blocks themselves.
|
long |
maxMemoryOverheadEncode(int dataBlocks,
int checkBlocks)
Maximum memory usage with the given number of data blocks and check blocks, not including
the blocks themselves.
|
getInstance
public void decode(byte[][] dataBlocks, byte[][] checkBlocks, boolean[] dataBlocksPresent, boolean[] checkBlocksPresent, int blockLength)
FECCodec
decode
in class FECCodec
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 void encode(byte[][] dataBlocks, byte[][] checkBlocks, boolean[] checkBlocksPresent, int blockLength)
FECCodec
public long maxMemoryOverheadDecode(int dataBlocks, int checkBlocks)
FECCodec
maxMemoryOverheadDecode
in class FECCodec
public long maxMemoryOverheadEncode(int dataBlocks, int checkBlocks)
FECCodec
maxMemoryOverheadEncode
in class FECCodec
public int getCheckBlocks(int dataBlocks, InsertContext.CompatibilityMode compatibilityMode)
FECCodec
getCheckBlocks
in class FECCodec
dataBlocks
- The number of data blocks per segment.compatibilityMode
- The compatibility mode (so we can exactly mimic the behaviour of older builds
when reinserting files).