-/* $RCSfile$\r
- * $Author$\r
- * $Date$\r
- * $Revision$\r
- *\r
- * Copyright (C) 2011 The Jmol Development Team\r
- *\r
- * Contact: jmol-developers@lists.sf.net\r
- *\r
- * This library is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU Lesser General Public\r
- * License as published by the Free Software Foundation; either\r
- * version 2.1 of the License, or (at your option) any later version.\r
- *\r
- * This library is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
- * Lesser General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU Lesser General Public\r
- * License along with this library; if not, write to the Free Software\r
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
- * 02110-1301, USA.\r
- */\r
-\r
-package javajs.util;\r
-\r
-\r
-class CompoundDocDirEntry {\r
-\r
- private final CompoundDocument cd;\r
-\r
- /**\r
- * @param compoundDocument\r
- */\r
- CompoundDocDirEntry(CompoundDocument compoundDocument) {\r
- cd = compoundDocument;\r
- }\r
-\r
- // 128 bytes\r
- //offset 0:\r
- byte[] unicodeName64 = new byte[64];\r
- short nBytesUnicodeName; // twice the ascii length, including terminating 0\r
- byte entryType; // 0 empty; 1 storage; 2 stream; 5 root storage\r
- //byte entryColor; // 0 red or 1 black\r
- //int DIDchildLeft;\r
- //int DIDchildRight;\r
- //int DIDstorageRoot;\r
- byte[] uniqueID16 = new byte[16];\r
- byte[] userflags4 = new byte[4];\r
- //long timeStamp1;\r
- //long timeStamp2;\r
- //offset 116:\r
- int SIDfirstSector; // either SAT or SSAT\r
- int lenStream;\r
- byte[] unused = new byte[8];\r
-\r
- // derived:\r
-\r
- String entryName;\r
- boolean isStandard;\r
- boolean isEmpty;\r
-\r
- final boolean readData() {\r
- try {\r
- cd.readByteArray(unicodeName64, 0, 64);\r
- nBytesUnicodeName = cd.readShort();\r
- entryType = cd.readByte();\r
- /*entryColor = */cd.readByte();\r
- /*DIDchildLeft = */cd.readInt();\r
- /*DIDchildRight = */cd.readInt();\r
- /*DIDstorageRoot = */cd.readInt();\r
- cd.readByteArray(uniqueID16, 0, 16);\r
- cd.readByteArray(userflags4, 0, 4);\r
- /*timeStamp1 = */ cd.readByteArray(unused, 0, 8);//cd.readLong();\r
- /*timeStamp2 = */ cd.readByteArray(unused, 0, 8);//cd.readLong();\r
- //offset 116:\r
- SIDfirstSector = cd.readInt();\r
- lenStream = cd.readInt();\r
- cd.readByteArray(unused, 0, 4);\r
- } catch (Exception e) {\r
- System.out.println(e.toString());\r
- return false;\r
- }\r
- entryName = "";\r
- for (int i = 0; i < nBytesUnicodeName - 2; i += 2)\r
- entryName += (char) unicodeName64[i];\r
- isStandard = (entryType == 5 || lenStream >= cd.header.minBytesStandardStream);\r
- isEmpty = (entryType == 0 || lenStream <= 0);\r
- //System.out.println(entryName + " type " + entryType);\r
- return true;\r
- }\r
+/* $RCSfile$
+ * $Author$
+ * $Date$
+ * $Revision$
+ *
+ * Copyright (C) 2011 The Jmol Development Team
+ *
+ * Contact: jmol-developers@lists.sf.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+package javajs.util;
+
+
+class CompoundDocDirEntry {
+
+ private final CompoundDocument cd;
+
+ /**
+ * @param compoundDocument
+ */
+ CompoundDocDirEntry(CompoundDocument compoundDocument) {
+ cd = compoundDocument;
+ }
+
+ // 128 bytes
+ //offset 0:
+ byte[] unicodeName64 = new byte[64];
+ short nBytesUnicodeName; // twice the ascii length, including terminating 0
+ byte entryType; // 0 empty; 1 storage; 2 stream; 5 root storage
+ //byte entryColor; // 0 red or 1 black
+ //int DIDchildLeft;
+ //int DIDchildRight;
+ //int DIDstorageRoot;
+ byte[] uniqueID16 = new byte[16];
+ byte[] userflags4 = new byte[4];
+ //long timeStamp1;
+ //long timeStamp2;
+ //offset 116:
+ int SIDfirstSector; // either SAT or SSAT
+ int lenStream;
+ byte[] unused = new byte[8];
+
+ // derived:
+
+ String entryName;
+ boolean isStandard;
+ boolean isEmpty;
+
+ final boolean readData() {
+ try {
+ cd.readByteArray(unicodeName64, 0, 64);
+ nBytesUnicodeName = cd.readShort();
+ entryType = cd.readByte();
+ /*entryColor = */cd.readByte();
+ /*DIDchildLeft = */cd.readInt();
+ /*DIDchildRight = */cd.readInt();
+ /*DIDstorageRoot = */cd.readInt();
+ cd.readByteArray(uniqueID16, 0, 16);
+ cd.readByteArray(userflags4, 0, 4);
+ /*timeStamp1 = */ cd.readByteArray(unused, 0, 8);//cd.readLong();
+ /*timeStamp2 = */ cd.readByteArray(unused, 0, 8);//cd.readLong();
+ //offset 116:
+ SIDfirstSector = cd.readInt();
+ lenStream = cd.readInt();
+ cd.readByteArray(unused, 0, 4);
+ } catch (Exception e) {
+ System.out.println(e.toString());
+ return false;
+ }
+ entryName = "";
+ for (int i = 0; i < nBytesUnicodeName - 2; i += 2)
+ entryName += (char) unicodeName64[i];
+ isStandard = (entryType == 5 || lenStream >= cd.header.minBytesStandardStream);
+ isEmpty = (entryType == 0 || lenStream <= 0);
+ //System.out.println(entryName + " type " + entryType);
+ return true;
+ }
}
\ No newline at end of file