public Decompressor(InputBuffer input, OutputBuffer output) : base(input, output) { /* Check the magic number */ if (((input.ReadByte() & 0xFF) != (Compress.magic_header [0] & 0xFF)) || ((input.ReadByte() & 0xFF) != (Compress.magic_header [1] & 0xFF))) { Console.Error.WriteLine("stdin: not in compressed format"); } maxBits = input.ReadByte(); /* set -b from file */ blockCompress = maxBits & Compress.BLOCK_MASK; maxBits &= Compress.BIT_MASK; maxMaxCode = 1 << maxBits; if (maxBits > Compress.BITS) { Console.Error.WriteLine("stdin: compressed with " + maxBits + " bits, can only handle " + Compress.BITS + " bits"); } bitsNumber = Compress.INIT_BITS; maxCode = MaxCode; offset = 0; size = 0; clearFlag = 0; freeEntry = ((blockCompress != 0) ? Compress.FIRST : 256); tabPrefix = new CodeTable(); tabSuffix = new SuffixTable(); deStack = new DeStack(); /* * As above, initialize the first 256 entries in the table. */ tabPrefix.Clear(256); tabSuffix.Init(256); }
public Decompressor (InputBuffer input, OutputBuffer output) : base (input, output) { /* Check the magic number */ if (((input.ReadByte () & 0xFF) != (Compress.magic_header [0] & 0xFF)) || ((input.ReadByte () & 0xFF) != (Compress.magic_header [1] & 0xFF))) Console.Error.WriteLine ("stdin: not in compressed format"); maxBits = input.ReadByte (); /* set -b from file */ blockCompress = maxBits & Compress.BLOCK_MASK; maxBits &= Compress.BIT_MASK; maxMaxCode = 1 << maxBits; if (maxBits > Compress.BITS) Console.Error.WriteLine ("stdin: compressed with " + maxBits + " bits, can only handle " + Compress.BITS + " bits"); bitsNumber = Compress.INIT_BITS; maxCode = MaxCode; offset = 0; size = 0; clearFlag = 0; freeEntry = ((blockCompress != 0) ? Compress.FIRST : 256); tabPrefix = new CodeTable (); tabSuffix = new SuffixTable (); deStack = new DeStack (); /* * As above, initialize the first 256 entries in the table. */ tabPrefix.Clear (256); tabSuffix.Init (256); }