Class Bzip2MTFAndRLE2StageEncoder


  • final class Bzip2MTFAndRLE2StageEncoder
    extends java.lang.Object
    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.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int alphabetSize
      The encoded alphabet size.
      private int[] bwtBlock
      The Burrows-Wheeler transformed block.
      private int bwtLength
      Actual length of the data in the bwtBlock array.
      private boolean[] bwtValuesPresent
      At each position, true if the byte value with that index is present within the block, otherwise false.
      private char[] mtfBlock
      The output of the Move To Front Transform and Run-Length Encoding[2] stages.
      private int mtfLength
      The actual number of values contained in the mtfBlock array.
      private int[] mtfSymbolFrequencies
      The global frequencies of values within the mtfBlock array.
    • Constructor Summary

      Constructors 
      Constructor Description
      Bzip2MTFAndRLE2StageEncoder​(int[] bwtBlock, int bwtLength, boolean[] bwtValuesPresent)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) void encode()
      Performs the Move To Front transform and Run Length Encoding[1] stages.
      (package private) int mtfAlphabetSize()  
      (package private) char[] mtfBlock()  
      (package private) int mtfLength()  
      (package private) int[] mtfSymbolFrequencies()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • bwtBlock

        private final int[] bwtBlock
        The Burrows-Wheeler transformed block.
      • bwtLength

        private final int bwtLength
        Actual length of the data in the bwtBlock array.
      • bwtValuesPresent

        private final boolean[] bwtValuesPresent
        At each position, true if the byte value with that index is present within the block, otherwise false.
      • mtfBlock

        private final char[] mtfBlock
        The output of the Move To Front Transform and Run-Length Encoding[2] stages.
      • mtfLength

        private int mtfLength
        The actual number of values contained in the mtfBlock array.
      • mtfSymbolFrequencies

        private final int[] mtfSymbolFrequencies
        The global frequencies of values within the mtfBlock array.
      • alphabetSize

        private int alphabetSize
        The encoded alphabet size.
    • Constructor Detail

      • Bzip2MTFAndRLE2StageEncoder

        Bzip2MTFAndRLE2StageEncoder​(int[] bwtBlock,
                                    int bwtLength,
                                    boolean[] bwtValuesPresent)
        Parameters:
        bwtBlock - The Burrows Wheeler Transformed block data
        bwtLength - The actual length of the BWT data
        bwtValuesPresent - The values that are present within the BWT data. For each index, true if that value is present within the data, otherwise false
    • Method Detail

      • 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