Package com.reve.reed.solomon
Class ReedSolomonOptimized
java.lang.Object
com.reve.reed.solomon.ReedSolomonOptimized
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionReedSolomonOptimized(int dataShardCount, int parityShardCount, CodingLoop codingLoop) Initializes a new encoder/decoder, with a chosen coding loop. -
Method Summary
Modifier and TypeMethodDescriptionstatic ReedSolomonOptimizedcreate(int dataShardCount, int parityShardCount) voiddecodeMissing(byte[][] shards, boolean[] shardPresent, int offset, int byteCount) Given a list of shards, some of which contain data, fills in the ones that don't have data.voiddecodeMissing(byte[][] shards, boolean[] shardPresent, int offset, int byteCount, int dataShardCount, int parityShardCount) Given a list of shards, some of which contain data, fills in the ones that don't have data.voidencodeParity(byte[][] shards, int offset, int byteCount) voidencodeParity(byte[][] shards, int offset, int byteCount, int dataShardCount, int parityShardCount) booleanisParityCorrect(byte[][] shards, int firstByte, int byteCount, int dataShardCount, int parityShardCount) Returns true if the parity shards contain the right data.
-
Field Details
-
dataShardCount
public final int dataShardCount -
parityShardsCount
public final int parityShardsCount
-
-
Constructor Details
-
ReedSolomonOptimized
Initializes a new encoder/decoder, with a chosen coding loop.
-
-
Method Details
-
create
-
isParityCorrect
public boolean isParityCorrect(byte[][] shards, int firstByte, int byteCount, int dataShardCount, int parityShardCount) Returns true if the parity shards contain the right data.- Parameters:
shards- An array containing data shards followed by parity shards. Each shard is a byte array, and they must all be the same size.firstByte- The index of the first byte in each shard to check.byteCount- The number of bytes to check in each shard.
-
encodeParity
public void encodeParity(byte[][] shards, int offset, int byteCount) -
encodeParity
public void encodeParity(byte[][] shards, int offset, int byteCount, int dataShardCount, int parityShardCount) -
decodeMissing
public void decodeMissing(byte[][] shards, boolean[] shardPresent, int offset, int byteCount) Given a list of shards, some of which contain data, fills in the ones that don't have data.Quickly does nothing if all the shards are present.
If any shards are missing (based on the flags in shardsPresent), the data in those shards is recomputed and filled in.
-
decodeMissing
public void decodeMissing(byte[][] shards, boolean[] shardPresent, int offset, int byteCount, int dataShardCount, int parityShardCount) Given a list of shards, some of which contain data, fills in the ones that don't have data.Quickly does nothing if all the shards are present.
If any shards are missing (based on the flags in shardsPresent), the data in those shards is recomputed and filled in.
-