Class Bzip2MTFAndRLE2StageEncoder
java.lang.Object
io.netty.handler.codec.compression.Bzip2MTFAndRLE2StageEncoder
An encoder for the Bzip2 Move To Front Transform and Run-Length Encoding[2] stages.
Although conceptually these two stages are separate, it is computationally efficient to perform them in one pass.
Although conceptually these two stages are separate, it is computationally efficient to perform them in one pass.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
The encoded alphabet size.private final int[]
The Burrows-Wheeler transformed block.private final int
Actual length of the data in thebwtBlock
array.private final boolean[]
At each position,true
if the byte value with that index is present within the block, otherwisefalse
.private final char[]
The output of the Move To Front Transform and Run-Length Encoding[2] stages.private int
The actual number of values contained in themtfBlock
array.private final int[]
The global frequencies of values within themtfBlock
array. -
Constructor Summary
ConstructorsConstructorDescriptionBzip2MTFAndRLE2StageEncoder
(int[] bwtBlock, int bwtLength, boolean[] bwtValuesPresent) -
Method Summary
-
Field Details
-
bwtBlock
private final int[] bwtBlockThe Burrows-Wheeler transformed block. -
bwtLength
private final int bwtLengthActual length of the data in thebwtBlock
array. -
bwtValuesPresent
private final boolean[] bwtValuesPresentAt each position,true
if the byte value with that index is present within the block, otherwisefalse
. -
mtfBlock
private final char[] mtfBlockThe output of the Move To Front Transform and Run-Length Encoding[2] stages. -
mtfLength
private int mtfLengthThe actual number of values contained in themtfBlock
array. -
mtfSymbolFrequencies
private final int[] mtfSymbolFrequenciesThe global frequencies of values within themtfBlock
array. -
alphabetSize
private int alphabetSizeThe encoded alphabet size.
-
-
Constructor Details
-
Bzip2MTFAndRLE2StageEncoder
Bzip2MTFAndRLE2StageEncoder(int[] bwtBlock, int bwtLength, boolean[] bwtValuesPresent) - Parameters:
bwtBlock
- The Burrows Wheeler Transformed block databwtLength
- The actual length of the BWT databwtValuesPresent
- The values that are present within the BWT data. For each index,true
if that value is present within the data, otherwisefalse
-
-
Method Details
-
encode
void encode()Performs the Move To Front transform and Run Length Encoding[1] stages. -
mtfBlock
char[] mtfBlock()- Returns:
- The encoded MTF block
-
mtfLength
int mtfLength()- Returns:
- The actual length of the MTF block
-
mtfAlphabetSize
int mtfAlphabetSize()- Returns:
- The size of the MTF block's alphabet
-
mtfSymbolFrequencies
int[] mtfSymbolFrequencies()- Returns:
- The frequencies of the MTF block's symbols
-