dojox/encoding/compression/lzw.js

  • Provides:

    • dojox.encoding.compression.lzw
  • dojox.encoding.compression.lzw.Encoder

    • type
      Function
    • parameters:
      • n: (typeof )
    • source: [view]
        this.size = n;
        this.init();
    • summary
  • dojox.encoding.compression.lzw.Encoder.size

    • summary
  • dojox.encoding.compression.lzw.Decoder

    • type
      Function
    • parameters:
      • n: (typeof )
    • source: [view]
        this.size = n;
        this.init();
    • summary
  • dojox.encoding.compression.lzw.Decoder.size

    • summary
  • dojox.encoding.compression.lzw.Encoder.init

    • type
      Function
    • source: [view]
         this.dict = {};
         for(var i = 0; i < this.size; ++i){
          this.dict[String.fromCharCode(i)] = i;
         }
         this.width = _bits(this.code = this.size);
         this.p = "";
    • summary
  • dojox.encoding.compression.lzw.Encoder.dict

    • summary
  • dojox.encoding.compression.lzw.Encoder.width

    • summary
  • dojox.encoding.compression.lzw.Encoder.p

    • summary
  • dojox.encoding.compression.lzw.Encoder.encode

    • type
      Function
    • parameters:
      • value: (typeof )
      • stream: (typeof )
    • source: [view]
         var c = String.fromCharCode(value), p = this.p + c, r = 0;
         // if already in the dictionary
         if(p in this.dict){
          this.p = p;
          return r;
         }
         stream.putBits(this.dict[this.p], this.width);
         // if we need to increase the code length
         if((this.code & (this.code + 1)) == 0){
          stream.putBits(this.code++, r = this.width++);
         }
         // add new string
         this.dict[p] = this.code++;
         this.p = c;
         return r + this.width;
    • summary
  • dojox.encoding.compression.lzw.Encoder.flush

    • type
      Function
    • parameters:
      • stream: (typeof )
    • source: [view]
         if(this.p.length == 0){
          return 0;
         }
         stream.putBits(this.dict[this.p], this.width);
         this.p = "";
         return this.width;
    • summary
  • dojox.encoding.compression.lzw.Encoder.p.length

    • summary
  • dojox.encoding.compression.lzw.Decoder.init

    • type
      Function
    • source: [view]
         this.codes = new Array(this.size);
         for(var i = 0; i < this.size; ++i){
          this.codes[i] = String.fromCharCode(i);
         }
         this.width = _bits(this.size);
         this.p = -1;
    • summary
  • dojox.encoding.compression.lzw.Decoder.codes

    • summary
  • dojox.encoding.compression.lzw.Decoder.width

    • summary
  • dojox.encoding.compression.lzw.Decoder.p

    • summary
  • dojox.encoding.compression.lzw.Decoder.decode

    • type
      Function
    • parameters:
      • stream: (typeof )
    • source: [view]
         var c = stream.getBits(this.width), v;
         if(c < this.codes.length){
          v = this.codes[c];
          if(this.p >= 0){
           this.codes.push(this.codes[this.p] + v.substr(0, 1));
          }
         }else{
          if((c & (c + 1)) == 0){
           this.codes.push("");
           ++this.width;
           return "";
          }
          var x = this.codes[this.p];
          v = x + x.substr(0, 1);
          this.codes.push(v);
         }
         this.p = c;
         return v;
    • summary
  • dojox.encoding.compression.lzw

    • type
      Object
    • summary
  • dojox.encoding.compression

    • type
      Object
    • summary
  • dojox.encoding

    • type
      Object
    • summary
  • dojox

    • type
      Object
    • summary