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