/** * @param outp destination for compressed data * @param codeSize the initial code size for the LZW compressor * @param TIFF flag indicating that TIFF lzw fudge needs to be applied * @exception IOException if underlying output stream error **/ public LZWCompressor(Stream outp, int codeSize, bool TIFF) { bf_ = new BitFile(outp, !TIFF); // set flag for GIF as NOT tiff codeSize_ = codeSize; tiffFudge_ = TIFF; clearCode_ = 1 << codeSize_; endOfInfo_ = clearCode_ + 1; numBits_ = codeSize_ + 1; limit_ = (1 << numBits_) - 1; if (tiffFudge_) { --limit_; } prefix_ = -1; lzss_ = new LZWStringTable(); lzss_.ClearTable(codeSize_); bf_.WriteBits(clearCode_, numBits_); }
/** * @param outp destination for compressed data * @param codeSize the initial code size for the LZW compressor * @param TIFF flag indicating that TIFF lzw fudge needs to be applied * @exception IOException if underlying output stream error **/ public LZWCompressor(Stream outp, int codeSize, bool TIFF) { bf_ = new BitFile(outp, !TIFF); // set flag for GIF as NOT tiff codeSize_ = codeSize; tiffFudge_ = TIFF; clearCode_ = 1 << codeSize_; endOfInfo_ = clearCode_ + 1; numBits_ = codeSize_ + 1; limit_ = (1 << numBits_) - 1; if (tiffFudge_) --limit_; prefix_ = -1; lzss_ = new LZWStringTable(); lzss_.ClearTable(codeSize_); bf_.WriteBits(clearCode_, numBits_); }