6 * Copyright (C) 2011 The Jmol Development Team
8 * Contact: jmol-developers@lists.sf.net
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
29 class CompoundDocDirEntry {
31 private final CompoundDocument cd;
34 * @param compoundDocument
36 CompoundDocDirEntry(CompoundDocument compoundDocument) {
37 cd = compoundDocument;
42 byte[] unicodeName64 = new byte[64];
43 short nBytesUnicodeName; // twice the ascii length, including terminating 0
44 byte entryType; // 0 empty; 1 storage; 2 stream; 5 root storage
45 //byte entryColor; // 0 red or 1 black
49 byte[] uniqueID16 = new byte[16];
50 byte[] userflags4 = new byte[4];
54 int SIDfirstSector; // either SAT or SSAT
56 byte[] unused = new byte[8];
64 final boolean readData() {
66 cd.readByteArray(unicodeName64, 0, 64);
67 nBytesUnicodeName = cd.readShort();
68 entryType = cd.readByte();
69 /*entryColor = */cd.readByte();
70 /*DIDchildLeft = */cd.readInt();
71 /*DIDchildRight = */cd.readInt();
72 /*DIDstorageRoot = */cd.readInt();
73 cd.readByteArray(uniqueID16, 0, 16);
74 cd.readByteArray(userflags4, 0, 4);
75 /*timeStamp1 = */ cd.readByteArray(unused, 0, 8);//cd.readLong();
76 /*timeStamp2 = */ cd.readByteArray(unused, 0, 8);//cd.readLong();
78 SIDfirstSector = cd.readInt();
79 lenStream = cd.readInt();
80 cd.readByteArray(unused, 0, 4);
81 } catch (Exception e) {
82 System.out.println(e.toString());
86 for (int i = 0; i < nBytesUnicodeName - 2; i += 2)
87 entryName += (char) unicodeName64[i];
88 isStandard = (entryType == 5 || lenStream >= cd.header.minBytesStandardStream);
89 isEmpty = (entryType == 0 || lenStream <= 0);
90 //System.out.println(entryName + " type " + entryType);