Example usage for org.apache.poi.poifs.filesystem DirectoryNode getStorageClsid

List of usage examples for org.apache.poi.poifs.filesystem DirectoryNode getStorageClsid

Introduction

In this page you can find the example usage for org.apache.poi.poifs.filesystem DirectoryNode getStorageClsid.

Prototype

public ClassID getStorageClsid() 

Source Link

Document

Gets the storage clsid of the directory entry

Usage

From source file:tv.amwa.maj.io.aaf.AAFTestRead.java

License:Apache License

@SuppressWarnings("unchecked")
public final static void entryIterator(DirectoryEntry directory) throws IOException {

    for (Iterator<Entry> iter = directory.getEntries(); iter.hasNext();) {
        Entry entry = (Entry) iter.next();

        if (entry instanceof DirectoryEntry) {
            //System.out.println(makeIndent() + "Directory :" + entry.getName());

            DirectoryNode dirNode = (DirectoryNode) entry;
            System.out.println(/*from www .  j  a v a 2s . c o m*/
                    makeIndent() + dirNode.getPath().toString() + " " + dirNode.getStorageClsid().toString());

            for (Iterator jerry = dirNode.getViewableIterator(); jerry.hasNext();) {

                Object theNext = jerry.next();
                // System.out.println("dirNode#" + theNext.toString());

                if (theNext instanceof DirectoryProperty) {

                    @SuppressWarnings("unused")
                    DirectoryProperty dirProperty = (DirectoryProperty) theNext;
                    // System.out.println("dirProperty#" + dirProperty.getShortDescription() + ": " + dirProperty.getSize());
                }

            }

            indent += 2;
            entryIterator((DirectoryEntry) entry);
        } else if (entry instanceof DocumentEntry) {
            System.out.println(makeIndent() + "Document : " + entry.getName());

            System.out.println(makeIndent() + "Documnent class: " + entry.getClass().getName());

            for (Iterator frank = ((DocumentNode) entry).getViewableIterator(); frank.hasNext();) {

                Object theNextDoc = frank.next();

                System.out.println("docNode#" + theNextDoc.toString());
                /*
                if (theNextDoc instanceof DocumentProperty) {
                           
                   DocumentProperty docProp = (DocumentProperty) theNextDoc;
                   System.out.println("docPropertyName: " + docProp.getName() + " " + docProp.getShortDescription());
                           
                   for ( Iterator ben = docProp.getViewableIterator() ; ben.hasNext() ; ) {
                      System.out.println("HELLO: " + ben.next().toString());
                   }
                }*/

                if (theNextDoc instanceof POIFSDocument) {

                    POIFSDocument theDoc = (POIFSDocument) theNextDoc;

                    System.out.println("docName: " + theDoc.getShortDescription());
                    System.out.println(
                            "docBlocks: " + theDoc.countBlocks() + " " + theDoc.getSmallBlocks().length);

                    BlockWritable[] blocks = theDoc.getSmallBlocks();
                    for (int x = 0; x < blocks.length; x++) {
                        System.out.println("Block " + x + ": " + blocks[x].toString());

                        if (blocks[x] instanceof SmallDocumentBlock) {

                            SmallDocumentBlock block = (SmallDocumentBlock) blocks[x];
                            System.out.println(Arrays.toString(block.getData()));
                        }
                    }
                }
            }

        } else {
            // currently, either an Entry is a DirectoryEntry or a DocumentEntry,
            // but in the future, there may be other entry subinterfaces. The
            // internal data structure certainly allows for a lot more entry types.
            System.out.println("Unknown entry of type " + entry.getClass().getName());
        }
    }

    indent -= 2;
}