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 Compressor(InputBuffer input, OutputBuffer output) : base(input, output) { if (maxBits < Benchmark.Compress.INIT_BITS) { maxBits = Benchmark.Compress.INIT_BITS; } if (maxBits > Benchmark.Compress.BITS) { maxBits = Benchmark.Compress.BITS; } maxMaxCode = 1 << maxBits; bitsNumber = Benchmark.Compress.INIT_BITS; maxCode = MaxCode; offset = 0; bytesOut = 3; /* includes 3-byte header mojo */ outCount = 0; clearFlag = 0; ratio = 0; inCount = 1; checkpoint = CHECK_GAP; freeEntry = ((blockCompress != 0) ? Benchmark.Compress.FIRST : 256); htab = new HashTable(); // dm/kmd 4/10/98 codetab = new CodeTable(); output.WriteByte(Benchmark.Compress.magic_header [0]); output.WriteByte(Benchmark.Compress.magic_header [1]); output.WriteByte((byte)(maxBits | blockCompress)); }
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 Compressor (InputBuffer input, OutputBuffer output) : base (input, output) { if (maxBits < Benchmark.Compress.INIT_BITS) maxBits = Benchmark.Compress.INIT_BITS; if (maxBits > Benchmark.Compress.BITS) maxBits = Benchmark.Compress.BITS; maxMaxCode = 1 << maxBits; bitsNumber = Benchmark.Compress.INIT_BITS; maxCode = MaxCode; offset = 0; bytesOut = 3; /* includes 3-byte header mojo */ outCount = 0; clearFlag = 0; ratio = 0; inCount = 1; checkpoint = CHECK_GAP; freeEntry = ((blockCompress != 0) ? Benchmark.Compress.FIRST : 256); htab = new HashTable (); // dm/kmd 4/10/98 codetab = new CodeTable (); output.WriteByte (Benchmark.Compress.magic_header [0]); output.WriteByte (Benchmark.Compress.magic_header [1]); output.WriteByte ((byte) (maxBits | blockCompress)); }