1 Clazz.declarePackage ("JU");
2 Clazz.load (["JU.ZStream"], "JU.Deflater", ["JU.Deflate"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.$finished = false;
5 Clazz.instantialize (this, arguments);
6 }, JU, "Deflater", JU.ZStream);
7 Clazz.defineMethod (c$, "init",
8 function (level, bits, nowrap) {
9 if (bits == 0) bits = 15;
10 this.$finished = false;
12 this.dstate = new JU.Deflate (this);
13 this.dstate.deflateInit2 (level, nowrap ? -bits : bits);
16 Clazz.overrideMethod (c$, "deflate",
18 if (this.dstate == null) {
20 }var ret = this.dstate.deflate (flush);
21 if (ret == 1) this.$finished = true;
24 Clazz.overrideMethod (c$, "end",
26 this.$finished = true;
27 if (this.dstate == null) return -2;
28 var ret = this.dstate.deflateEnd ();
33 Clazz.defineMethod (c$, "params",
34 function (level, strategy) {
35 if (this.dstate == null) return -2;
36 return this.dstate.deflateParams (level, strategy);
38 Clazz.defineMethod (c$, "setDictionary",
39 function (dictionary, dictLength) {
40 if (this.dstate == null) return -2;
41 return this.dstate.deflateSetDictionary (dictionary, dictLength);
43 Clazz.overrideMethod (c$, "finished",
45 return this.$finished;
47 Clazz.defineMethod (c$, "finish",
50 Clazz.defineMethod (c$, "getBytesRead",
52 return this.dstate.getBytesRead ();
54 Clazz.defineMethod (c$, "getBytesWritten",
56 return this.dstate.getBytesWritten ();
58 Clazz.defineStatics (c$,
61 "$Z_STREAM_ERROR", -2);