Example usage for org.apache.poi.poifs.filesystem DocumentNode getShortDescription

List of usage examples for org.apache.poi.poifs.filesystem DocumentNode getShortDescription

Introduction

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

Prototype


public String getShortDescription() 

Source Link

Document

Provides a short description of the object, to be used when a POIFSViewable object has not provided its contents.

Usage

From source file:org.opf_labs.aqua.OfficeAnalyser.java

License:Apache License

public static void dump(DirectoryEntry root) throws IOException {
    System.out.println(root.getName() + " : storage CLSID " + root.getStorageClsid());
    for (Iterator it = root.getEntries(); it.hasNext();) {
        Entry entry = (Entry) it.next();
        if (entry instanceof DocumentNode) {
            DocumentNode node = (DocumentNode) entry;
            System.out.println("Node name: " + node.getName());
            System.out.println("Node desc: " + node.getShortDescription());
            System.out.println("Node size: " + node.getSize());
            DocumentInputStream is = new DocumentInputStream(node);

            try {
                PropertySet ps = new PropertySet(is);
                if (ps.getSectionCount() != 0) {
                    for (Property p : ps.getProperties()) {
                        System.out.println("Prop: " + p.getID() + " " + p.getValue());
                    }/* ww  w  .j  a  v a  2  s. c o  m*/
                }
            } catch (NoPropertySetStreamException e) {
                // TODO Auto-generated catch block
                //e.printStackTrace();
            } catch (MarkUnsupportedException e) {
                // TODO Auto-generated catch block
                //e.printStackTrace();
            }
            //byte[] bytes = new byte[node.getSize()];
            //is.read(bytes);
            //is.close();

            //FileOutputStream out = new FileOutputStream(new File(parent, node.getName().trim()));
            //out.write(bytes);
            //out.close();
            //System.out.println("Node: "+new String(bytes).substring(0, 10));
        } else if (entry instanceof DirectoryEntry) {
            DirectoryEntry dir = (DirectoryEntry) entry;
            dump(dir);
        } else {
            System.err.println("Skipping unsupported POIFS entry: " + entry);
        }
    }
}

From source file:uk.bl.wa.tika.parser.ole2.OLE2Parser.java

License:Open Source License

public static void dump(DirectoryEntry root) throws IOException {
    System.out.println(root.getName() + " : storage CLSID " + root.getStorageClsid());
    for (Iterator it = root.getEntries(); it.hasNext();) {
        Entry entry = (Entry) it.next();
        if (entry instanceof DocumentNode) {
            DocumentNode node = (DocumentNode) entry;
            System.out.println("Node name: " + node.getName());
            System.out.println("Node desc: " + node.getShortDescription());
            System.out.println("Node size: " + node.getSize());
            DocumentInputStream is = new DocumentInputStream(node);

            try {
                PropertySet ps = new PropertySet(is);
                if (ps.getSectionCount() != 0) {
                    for (Property p : ps.getProperties()) {
                        System.out.println("Prop: " + p.getID() + " " + p.getValue());
                    }/*ww  w. j  a  v  a2 s . c o  m*/
                }
            } catch (NoPropertySetStreamException e) {
                // TODO Auto-generated catch block
                //e.printStackTrace();
            }
            //byte[] bytes = new byte[node.getSize()];
            //is.read(bytes);
            //is.close();

            //FileOutputStream out = new FileOutputStream(new File(parent, node.getName().trim()));
            //out.write(bytes);
            //out.close();
            //System.out.println("Node: "+new String(bytes).substring(0, 10));
        } else if (entry instanceof DirectoryEntry) {
            DirectoryEntry dir = (DirectoryEntry) entry;
            dump(dir);
        } else {
            System.err.println("Skipping unsupported POIFS entry: " + entry);
        }
    }
}