JAL-1807 Bob's JalviewJS prototype first commit
[jalviewjs.git] / site / j2s / JU / CompoundDocDirEntry.js
1 Clazz.declarePackage ("JU");\r
2 c$ = Clazz.decorateAsClass (function () {\r
3 this.cd = null;\r
4 this.unicodeName64 = null;\r
5 this.nBytesUnicodeName = 0;\r
6 this.entryType = 0;\r
7 this.uniqueID16 = null;\r
8 this.userflags4 = null;\r
9 this.SIDfirstSector = 0;\r
10 this.lenStream = 0;\r
11 this.unused = null;\r
12 this.entryName = null;\r
13 this.isStandard = false;\r
14 this.isEmpty = false;\r
15 Clazz.instantialize (this, arguments);\r
16 }, JU, "CompoundDocDirEntry");\r
17 Clazz.prepareFields (c$, function () {\r
18 this.unicodeName64 =  Clazz.newByteArray (64, 0);\r
19 this.uniqueID16 =  Clazz.newByteArray (16, 0);\r
20 this.userflags4 =  Clazz.newByteArray (4, 0);\r
21 this.unused =  Clazz.newByteArray (8, 0);\r
22 });\r
23 Clazz.makeConstructor (c$, \r
24 function (compoundDocument) {\r
25 this.cd = compoundDocument;\r
26 }, "JU.CompoundDocument");\r
27 Clazz.defineMethod (c$, "readData", \r
28 function () {\r
29 try {\r
30 this.cd.readByteArray (this.unicodeName64, 0, 64);\r
31 this.nBytesUnicodeName = this.cd.readShort ();\r
32 this.entryType = this.cd.readByte ();\r
33 this.cd.readByte ();\r
34 this.cd.readInt ();\r
35 this.cd.readInt ();\r
36 this.cd.readInt ();\r
37 this.cd.readByteArray (this.uniqueID16, 0, 16);\r
38 this.cd.readByteArray (this.userflags4, 0, 4);\r
39 this.cd.readByteArray (this.unused, 0, 8);\r
40 this.cd.readByteArray (this.unused, 0, 8);\r
41 this.SIDfirstSector = this.cd.readInt ();\r
42 this.lenStream = this.cd.readInt ();\r
43 this.cd.readByteArray (this.unused, 0, 4);\r
44 } catch (e) {\r
45 if (Clazz.exceptionOf (e, Exception)) {\r
46 System.out.println (e.toString ());\r
47 return false;\r
48 } else {\r
49 throw e;\r
50 }\r
51 }\r
52 this.entryName = "";\r
53 for (var i = 0; i < this.nBytesUnicodeName - 2; i += 2) this.entryName += String.fromCharCode (this.unicodeName64[i]);\r
54 \r
55 this.isStandard = (this.entryType == 5 || this.lenStream >= this.cd.header.minBytesStandardStream);\r
56 this.isEmpty = (this.entryType == 0 || this.lenStream <= 0);\r
57 return true;\r
58 });\r