/** * Indicate to compressor that no more data to go so write out * any remaining buffered data. * * @exception IOException if underlying output stream error **/ public void flush() throws IOException { if (prefix_ != -1) bf_.writeBits(prefix_, numBits_); bf_.writeBits(endOfInfo_, numBits_); bf_.flush(); }
/** * @param out 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(ImageOutputStream out, int codeSize, boolean TIFF) throws IOException { bf_ = new BitFile(out, !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_ = (short)0xFFFF; lzss_ = new LZWStringTable(); lzss_.ClearTable(codeSize_); bf_.writeBits(clearCode_, numBits_); }
/** * @param out 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(ImageOutputStream out, int codeSize, boolean TIFF) throws IOException { bf_ = new BitFile(out, !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_ = (short)0xFFFF; lzss_ = new LZWStringTable(); lzss_.ClearTable(codeSize_); bf_.writeBits(clearCode_, numBits_); }
/** * Indicate to compressor that no more data to go so write out * any remaining buffered data. * * @exception IOException if underlying output stream error **/ public void flush() throws IOException { if (prefix_ != -1) bf_.writeBits(prefix_, numBits_); bf_.writeBits(endOfInfo_, numBits_); bf_.flush(); }
/** * @param out 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(ImageOutputStream out, int codeSize, boolean TIFF) throws IOException { bf_ = new BitFile(out, !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_ = (short)0xFFFF; lzss_ = new LZWStringTable(); lzss_.ClearTable(codeSize_); bf_.writeBits(clearCode_, numBits_); }
/** * Indicate to compressor that no more data to go so write out * any remaining buffered data. * * @exception IOException if underlying output stream error **/ public void flush() throws IOException { if (prefix_ != -1) bf_.writeBits(prefix_, numBits_); bf_.writeBits(endOfInfo_, numBits_); bf_.flush(); }