/** * Public constructor * @param bitInputStream The BZip2BitInputStream from which Huffman codes are read * @param alphabetSize The total number of codes (uniform for each table) * @param tableCodeLengths The Canonical Huffman code lengths for each table * @param selectors The Huffman table number to use for each group of 50 symbols */ public BZip2HuffmanStageDecoder(BZip2BitInputStream bitInputStream, int alphabetSize, byte[,] tableCodeLengths, byte[] selectors) { this.bitInputStream = bitInputStream; this.selectors = selectors; this.currentTable = this.selectors[0]; this.CreateHuffmanDecodingTables(alphabetSize, tableCodeLengths); }
/// <summary>Public constructor</summary> /// <param name="inputStream">The InputStream to wrap</param> /// <param name="headerless">If true, the caller is assumed to have read away the stream's /// leading "BZ" identifier bytes</param> public BZip2InputStream(Stream inputStream, bool headerless) { if (inputStream == null) { throw new ArgumentException("Null input stream"); } this.inputStream = inputStream; this.bitInputStream = new BZip2BitInputStream(inputStream); this.headerless = headerless; }
public override void Close() { if (this.bitInputStream == null) return; this.streamComplete = true; this.blockDecompressor = null; this.bitInputStream = null; try { this.inputStream.Close(); } finally { this.inputStream = null; } }
/** * Public constructor * @param bitInputStream The BZip2BitInputStream to read from * @param blockSize The maximum decoded size of the block * Exception If the block could not be decoded */ public BZip2BlockDecompressor(BZip2BitInputStream bitInputStream, uint blockSize) { this.bitInputStream = bitInputStream; this.bwtBlock = new byte[blockSize]; // Read block header this.blockCRC = this.bitInputStream.ReadInteger(); //.ReadBits(32); this.blockRandomised = this.bitInputStream.ReadBoolean(); uint bwtStartPointer = this.bitInputStream.ReadBits(24); // Read block data and decode through to the Inverse Burrows Wheeler Transform stage var huffmanDecoder = this.ReadHuffmanTables(); this.DecodeHuffmanData(huffmanDecoder); this.InitialiseInverseBWT(bwtStartPointer); }