JAL-1807 Bob's JalviewJS prototype first commit
[jalviewjs.git] / site / j2s / JU / CompoundDocHeader.js
1 Clazz.declarePackage ("JU");\r
2 c$ = Clazz.decorateAsClass (function () {\r
3 this.cd = null;\r
4 this.magicNumbers = null;\r
5 this.uniqueID16 = null;\r
6 this.revNumber = 0;\r
7 this.verNumber = 0;\r
8 this.sectorPower = 0;\r
9 this.shortSectorPower = 0;\r
10 this.unused = null;\r
11 this.nSATsectors = 0;\r
12 this.SID_DIR_start = 0;\r
13 this.minBytesStandardStream = 0;\r
14 this.SID_SSAT_start = 0;\r
15 this.nSSATsectors = 0;\r
16 this.SID_MSAT_next = 0;\r
17 this.nAdditionalMATsectors = 0;\r
18 this.MSAT0 = null;\r
19 Clazz.instantialize (this, arguments);\r
20 }, JU, "CompoundDocHeader");\r
21 Clazz.prepareFields (c$, function () {\r
22 this.magicNumbers =  Clazz.newByteArray (8, 0);\r
23 this.uniqueID16 =  Clazz.newByteArray (16, 0);\r
24 this.unused =  Clazz.newByteArray (10, 0);\r
25 this.MSAT0 =  Clazz.newIntArray (109, 0);\r
26 });\r
27 Clazz.makeConstructor (c$, \r
28 function (compoundDocument) {\r
29 this.cd = compoundDocument;\r
30 }, "JU.CompoundDocument");\r
31 Clazz.defineMethod (c$, "readData", \r
32 function () {\r
33 try {\r
34 this.cd.readByteArray (this.magicNumbers, 0, 8);\r
35 if (this.magicNumbers[0] != 0xD0 || this.magicNumbers[1] != 0xCF || this.magicNumbers[2] != 0x11 || this.magicNumbers[3] != 0xE0 || this.magicNumbers[4] != 0xA1 || this.magicNumbers[5] != 0xB1 || this.magicNumbers[6] != 0x1A || this.magicNumbers[7] != 0xE1) return false;\r
36 this.cd.readByteArray (this.uniqueID16, 0, 16);\r
37 this.revNumber = this.cd.readByte ();\r
38 this.cd.readByte ();\r
39 this.verNumber = this.cd.readByte ();\r
40 this.cd.readByte ();\r
41 var b1 = this.cd.readByte ();\r
42 var b2 = this.cd.readByte ();\r
43 this.cd.isBigEndian = (b1 == -1 && b2 == -2);\r
44 this.sectorPower = this.cd.readShort ();\r
45 this.shortSectorPower = this.cd.readShort ();\r
46 this.cd.readByteArray (this.unused, 0, 10);\r
47 this.nSATsectors = this.cd.readInt ();\r
48 this.SID_DIR_start = this.cd.readInt ();\r
49 this.cd.readByteArray (this.unused, 0, 4);\r
50 this.minBytesStandardStream = this.cd.readInt ();\r
51 this.SID_SSAT_start = this.cd.readInt ();\r
52 this.nSSATsectors = this.cd.readInt ();\r
53 this.SID_MSAT_next = this.cd.readInt ();\r
54 this.nAdditionalMATsectors = this.cd.readInt ();\r
55 for (var i = 0; i < 109; i++) this.MSAT0[i] = this.cd.readInt ();\r
56 \r
57 } catch (e) {\r
58 if (Clazz.exceptionOf (e, Exception)) {\r
59 System.out.println (e.toString ());\r
60 return false;\r
61 } else {\r
62 throw e;\r
63 }\r
64 }\r
65 return true;\r
66 });\r