Index: src/java/org/apache/poi/poifs/filesystem/DirectoryEntry.java =================================================================== RCS file: /home/cvspublic/jakarta-poi/src/java/org/apache/poi/poifs/filesystem/DirectoryEntry.java,v --- src/java/org/apache/poi/poifs/filesystem/DirectoryEntry.java 30 Apr 2003 04:39:07 -0000 1.2 +++ src/java/org/apache/poi/poifs/filesystem/DirectoryEntry.java 29 Oct 2003 22:56:18 -0000 @@ -160,5 +160,22 @@ public DirectoryEntry createDirectory(final String name) throws IOException; + + /** + * @return CLSID assigned to the directory entry + * "{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}" + */ + + public String getCLSID(); + + /** + * Sets CLSID to be assigned to the directory entry. + * "{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}" + * + * @param CLSID to be assigned to the directory entry + */ + + public void setCLSID(final String clsid); + } // end public interface DirectoryEntry Index: src/java/org/apache/poi/poifs/filesystem/DirectoryNode.java =================================================================== RCS file: /home/cvspublic/jakarta-poi/src/java/org/apache/poi/poifs/filesystem/DirectoryNode.java,v --- src/java/org/apache/poi/poifs/filesystem/DirectoryNode.java 30 Apr 2003 04:39:07 -0000 1.2 +++ src/java/org/apache/poi/poifs/filesystem/DirectoryNode.java 29 Oct 2003 22:56:18 -0000 @@ -346,6 +346,28 @@ return rval; } + /** + * @return CLSID assigned to the directory entry + * "{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}" + */ + + public String getCLSID() + { + return (( DirectoryProperty )getProperty()).getCLSID(); + } + + /** + * Sets CLSID to be assigned to the directory entry. + * "{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}" + * + * @param CLSID to be assigned to the directory entry + */ + + public void setCLSID(final String clsid) + { + (( DirectoryProperty )getProperty()).setCLSID(clsid); + } + /* ********** END implementation of DirectoryEntry ********** */ /* ********** START implementation of Entry ********** */ Index: src/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java =================================================================== RCS file: /home/cvspublic/jakarta-poi/src/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java,v --- src/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java 30 Apr 2003 04:39:07 -0000 1.4 +++ src/java/org/apache/poi/poifs/filesystem/POIFSFileSystem.java 29 Oct 2003 22:56:18 -0000 @@ -423,6 +423,8 @@ DirectoryNode new_dir = ( DirectoryNode ) parent.createDirectory(name); + ((DirectoryProperty)new_dir.getProperty()).setCLSID(property.getCLSID()); + processProperties( small_blocks, big_blocks, (( DirectoryProperty ) property).getChildren(), new_dir); Index: src/java/org/apache/poi/poifs/property/Property.java =================================================================== RCS file: /home/cvspublic/jakarta-poi/src/java/org/apache/poi/poifs/property/Property.java,v --- src/java/org/apache/poi/poifs/property/Property.java 30 Apr 2003 04:39:16 -0000 1.3 +++ src/java/org/apache/poi/poifs/property/Property.java 29 Oct 2003 22:56:18 -0000 @@ -65,6 +65,8 @@ import org.apache.poi.util.IntegerField; import org.apache.poi.util.LittleEndianConsts; import org.apache.poi.util.ShortField; +import org.apache.poi.util.ByteArrayField; +import org.apache.poi.util.HexDump; /** * This abstract base class is the ancestor of all classes @@ -87,6 +89,7 @@ static final private int _previous_property_offset = 0x44; static final private int _next_property_offset = 0x48; static final private int _child_property_offset = 0x4C; + static final private int _clsid_offset = 0x50; static final private int _seconds_1_offset = 0x64; static final private int _days_1_offset = 0x68; static final private int _seconds_2_offset = 0x6C; @@ -107,6 +110,7 @@ private IntegerField _previous_property; private IntegerField _next_property; private IntegerField _child_property; + private ByteArrayField _clsid; private IntegerField _seconds_1; private IntegerField _days_1; private IntegerField _seconds_2; @@ -136,6 +140,8 @@ _NO_INDEX, _raw_data); _child_property = new IntegerField(_child_property_offset, _NO_INDEX, _raw_data); + _clsid = new ByteArrayField(_clsid_offset, 16, _raw_data); + _seconds_1 = new IntegerField(_seconds_1_offset, 0, _raw_data); _days_1 = new IntegerField(_days_1_offset, 0, _raw_data); @@ -173,6 +179,7 @@ _raw_data); _child_property = new IntegerField(_child_property_offset, _raw_data); + _clsid = new ByteArrayField(_clsid_offset, 16, _raw_data); _seconds_1 = new IntegerField(_seconds_1_offset, _raw_data); _days_1 = new IntegerField(_days_1_offset, _raw_data); _seconds_2 = new IntegerField(_seconds_2_offset, _raw_data); @@ -445,6 +452,68 @@ static boolean isValidIndex(int index) { return index != _NO_INDEX; + } + + /** + * @return CLSID assigned to the directory property + * + * "{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}" + * offset 01234567890123456789012345678901234567 + * [0..37] 0 1 2 3 + * + */ + + private final static int[] clsid_separator_offset = { 0, 9, 14, 19, 24, 37 }; + private final static char[] clsid_separator_char = { '{', '-', '-', '-', '-', '}' }; + private final static byte[] clsid_byte2str = { 3,2,1,0,5,4,7,6,8,9,10,11,12,13,14,15 }; + + public String getCLSID() + { + StringBuffer buf = new StringBuffer(38); + + byte[] data = _clsid.get(); + for (int i=0; i< data.length; i++) + buf.append(HexDump.toHex(data[clsid_byte2str[i]])); + + for (int i=0; i