Example usage for org.apache.poi.poifs.filesystem DirectoryEntry getEntryCount

List of usage examples for org.apache.poi.poifs.filesystem DirectoryEntry getEntryCount

Introduction

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

Prototype


public int getEntryCount();

Source Link

Document

find out how many Entry instances are contained directly within this DirectoryEntry

Usage

From source file:net.sf.mpxj.explorer.PoiTreeModel.java

License:Open Source License

@Override
public int getChildCount(Object parent) {
    int result;//from   w ww  .  ja va2s. c  o  m
    if (parent instanceof DirectoryEntry) {
        DirectoryEntry node = (DirectoryEntry) parent;
        result = node.getEntryCount();
    } else {
        result = 0;
    }
    return result;
}

From source file:nz.govt.natlib.adapter.excel.ExcelAdapter.java

License:Apache License

public void readDirectory(POIFSFileSystem fs, DirectoryEntry dir) throws Exception {
    if (dir.getEntryCount() == 0) {
        return;// ww  w  .j  a  v  a 2  s  . c  o m
    }

    for (Iterator iter = dir.getEntries(); iter.hasNext();) {
        Entry entry = (Entry) iter.next();
        if (entry instanceof DirectoryEntry) {
            // .. recurse into this directory
            readDirectory(fs, (DirectoryEntry) entry);
        } else if (entry instanceof DocumentEntry) {
            // entry is a document, which you can read
            DocumentEntry doc = (DocumentEntry) entry;
            readDocument(fs, doc);
        } 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.
        }
    }
}

From source file:nz.govt.natlib.adapter.powerpoint.PowerPointAdapter.java

License:Apache License

public void readDirectory(POIFSFileSystem fs, DirectoryEntry dir) throws Exception {
    if (dir.getEntryCount() == 0) {
        return;/*from   ww w.j a v a2s .  c  o m*/
    }

    for (Iterator iter = dir.getEntries(); iter.hasNext();) {
        Entry entry = (Entry) iter.next();
        System.out.println("found entry: " + entry.getName());
        if (entry instanceof DirectoryEntry) {
            // .. recurse into this directory
            readDirectory(fs, (DirectoryEntry) entry);
        } else if (entry instanceof DocumentEntry) {
            // entry is a document, which you can read
            DocumentEntry doc = (DocumentEntry) entry;
            readDocument(fs, doc);
        } 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.
        }
    }
}

From source file:nz.govt.natlib.adapter.works.DocAdapter.java

License:Apache License

public void readDirectory(POIFSFileSystem fs, DirectoryEntry dir, ParserContext ctx) throws Exception {
    if (dir.getEntryCount() == 0) {
        return;/*from   w ww  .j  a v a  2 s . c  o m*/
    }

    for (Iterator iter = dir.getEntries(); iter.hasNext();) {
        Entry entry = (Entry) iter.next();
        // System.out.println("found entry: " + entry.getName());
        if (entry instanceof DirectoryEntry) {
            // .. recurse into this directory
            // System.out.println(" > Directory...");
            readDirectory(fs, (DirectoryEntry) entry, ctx);
        } else if (entry instanceof DocumentEntry) {
            // entry is a document, which you can read
            // System.out.println(" > Document");
            DocumentEntry doc = (DocumentEntry) entry;
            ArrayList list = readDocument(fs, doc);

            if (entry.getName().endsWith("CompObj")) {
                writeCompObjProps(list, ctx);
            }
        } 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(" > Other");
        }
    }
}