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