1 Clazz.declarePackage ("JU");
\r
2 Clazz.load (null, "JU.GZIPHeader", ["JU.ZStream", "java.lang.IllegalArgumentException", "$.InternalError"], function () {
\r
3 c$ = Clazz.decorateAsClass (function () {
\r
11 this.comment = null;
\r
16 Clazz.instantialize (this, arguments);
\r
17 }, JU, "GZIPHeader", null, Cloneable);
\r
18 Clazz.defineMethod (c$, "setModifiedTime",
\r
22 Clazz.defineMethod (c$, "getModifiedTime",
\r
26 Clazz.defineMethod (c$, "setOS",
\r
28 if ((0 <= os && os <= 13) || os == 255) this.os = os;
\r
29 else throw new IllegalArgumentException ("os: " + os);
\r
31 Clazz.defineMethod (c$, "getOS",
\r
35 Clazz.defineMethod (c$, "setName",
\r
37 this.name = JU.ZStream.getBytes (name);
\r
39 Clazz.defineMethod (c$, "getName",
\r
41 if (this.name == null) return "";
\r
43 return String.instantialize (this.name, "ISO-8859-1");
\r
45 if (Clazz.exceptionOf (e, java.io.UnsupportedEncodingException)) {
\r
46 throw new InternalError (e.toString ());
\r
52 Clazz.defineMethod (c$, "setComment",
\r
53 function (comment) {
\r
54 this.comment = JU.ZStream.getBytes (comment);
\r
56 Clazz.defineMethod (c$, "getComment",
\r
58 if (this.comment == null) return "";
\r
60 return String.instantialize (this.comment, "ISO-8859-1");
\r
62 if (Clazz.exceptionOf (e, java.io.UnsupportedEncodingException)) {
\r
63 throw new InternalError (e.toString ());
\r
69 Clazz.defineMethod (c$, "setCRC",
\r
73 Clazz.defineMethod (c$, "getCRC",
\r
77 Clazz.defineMethod (c$, "put",
\r
84 }if (this.extra != null) {
\r
86 }if (this.name != null) {
\r
88 }if (this.comment != null) {
\r
93 } else if (d.level == 9) {
\r
95 }d.put_short (0x8b1f);
\r
98 d.put_byteB (this.mtime);
\r
99 d.put_byteB ((this.mtime >> 8));
\r
100 d.put_byteB ((this.mtime >> 16));
\r
101 d.put_byteB ((this.mtime >> 24));
\r
103 d.put_byteB (this.os);
\r
104 if (this.extra != null) {
\r
105 d.put_byteB (this.extra.length);
\r
106 d.put_byteB ((this.extra.length >> 8));
\r
107 d.put_byte (this.extra, 0, this.extra.length);
\r
108 }if (this.name != null) {
\r
109 d.put_byte (this.name, 0, this.name.length);
\r
111 }if (this.comment != null) {
\r
112 d.put_byte (this.comment, 0, this.comment.length);
\r
115 Clazz.defineMethod (c$, "clone",
\r
117 var gheader = Clazz.superCall (this, JU.GZIPHeader, "clone", []);
\r
119 if (gheader.extra != null) {
\r
120 tmp = Clazz.newByteArray (gheader.extra.length, 0);
\r
121 System.arraycopy (gheader.extra, 0, tmp, 0, tmp.length);
\r
122 gheader.extra = tmp;
\r
123 }if (gheader.name != null) {
\r
124 tmp = Clazz.newByteArray (gheader.name.length, 0);
\r
125 System.arraycopy (gheader.name, 0, tmp, 0, tmp.length);
\r
126 gheader.name = tmp;
\r
127 }if (gheader.comment != null) {
\r
128 tmp = Clazz.newByteArray (gheader.comment.length, 0);
\r
129 System.arraycopy (gheader.comment, 0, tmp, 0, tmp.length);
\r
130 gheader.comment = tmp;
\r
133 Clazz.defineStatics (c$,
\r
144 "OS_ZSYSTEM", 0x08,
\r
148 "OS_UNKNOWN", 0xff);
\r