Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / JU / Inflater.js
1 Clazz.declarePackage ("JU");
2 Clazz.load (["JU.ZStream"], "JU.Inflater", ["JU.Inflate"], function () {
3 c$ = Clazz.declareType (JU, "Inflater", JU.ZStream);
4 Clazz.defineMethod (c$, "init", 
5 function (w, nowrap) {
6 this.setAdler32 ();
7 if (w == 0) w = 15;
8 this.istate =  new JU.Inflate (this);
9 this.istate.inflateInit (nowrap ? -w : w);
10 return this;
11 }, "~N,~B");
12 Clazz.overrideMethod (c$, "inflate", 
13 function (f) {
14 if (this.istate == null) return -2;
15 var ret = this.istate.inflate (f);
16 return ret;
17 }, "~N");
18 Clazz.overrideMethod (c$, "end", 
19 function () {
20 if (this.istate == null) return -2;
21 var ret = this.istate.inflateEnd ();
22 return ret;
23 });
24 Clazz.defineMethod (c$, "sync", 
25 function () {
26 if (this.istate == null) return -2;
27 return this.istate.inflateSync ();
28 });
29 Clazz.defineMethod (c$, "syncPoint", 
30 function () {
31 if (this.istate == null) return -2;
32 return this.istate.inflateSyncPoint ();
33 });
34 Clazz.defineMethod (c$, "setDictionary", 
35 function (dictionary, dictLength) {
36 if (this.istate == null) return -2;
37 return this.istate.inflateSetDictionary (dictionary, dictLength);
38 }, "~A,~N");
39 Clazz.overrideMethod (c$, "finished", 
40 function () {
41 return this.istate.mode == 12;
42 });
43 Clazz.defineMethod (c$, "reset", 
44 function () {
45 this.avail_in = 0;
46 if (this.istate != null) this.istate.reset ();
47 });
48 Clazz.defineStatics (c$,
49 "MAX_WBITS", 15,
50 "DEF_WBITS", 15,
51 "$Z_STREAM_ERROR", -2);
52 });