6 * Some portions of this file have been modified by Robert Hanson hansonr.at.stolaf.edu 2012-2017
7 * for use in SwingJS via transpilation into JavaScript using Java2Script.
9 * Copyright (C) 2011 The Jmol Development Team
11 * Contact: jmol-developers@lists.sf.net
13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Lesser General Public
15 * License as published by the Free Software Foundation; either
16 * version 2.1 of the License, or (at your option) any later version.
18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Lesser General Public License for more details.
23 * You should have received a copy of the GNU Lesser General Public
24 * License along with this library; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
32 class CompoundDocDirEntry {
34 private final CompoundDocument cd;
37 * @param compoundDocument
39 CompoundDocDirEntry(CompoundDocument compoundDocument) {
40 cd = compoundDocument;
45 byte[] unicodeName64 = new byte[64];
46 short nBytesUnicodeName; // twice the ascii length, including terminating 0
47 byte entryType; // 0 empty; 1 storage; 2 stream; 5 root storage
48 //byte entryColor; // 0 red or 1 black
52 byte[] uniqueID16 = new byte[16];
53 byte[] userflags4 = new byte[4];
57 int SIDfirstSector; // either SAT or SSAT
59 byte[] unused = new byte[8];
67 final boolean readData() {
69 cd.readByteArray(unicodeName64, 0, 64);
70 nBytesUnicodeName = cd.readShort();
71 entryType = cd.readByte();
72 /*entryColor = */cd.readByte();
73 /*DIDchildLeft = */cd.readInt();
74 /*DIDchildRight = */cd.readInt();
75 /*DIDstorageRoot = */cd.readInt();
76 cd.readByteArray(uniqueID16, 0, 16);
77 cd.readByteArray(userflags4, 0, 4);
78 /*timeStamp1 = */ cd.readByteArray(unused, 0, 8);//cd.readLong();
79 /*timeStamp2 = */ cd.readByteArray(unused, 0, 8);//cd.readLong();
81 SIDfirstSector = cd.readInt();
82 lenStream = cd.readInt();
83 cd.readByteArray(unused, 0, 4);
84 } catch (Exception e) {
85 System.out.println(e.toString());
89 for (int i = 0; i < nBytesUnicodeName - 2; i += 2)
90 entryName += (char) unicodeName64[i];
91 isStandard = (entryType == 5 || lenStream >= cd.header.minBytesStandardStream);
92 isEmpty = (entryType == 0 || lenStream <= 0);
93 //System.out.println(entryName + " type " + entryType);
98 public String toString() {
99 return entryName + " " + lenStream;