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