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