Example usage for org.apache.poi.poifs.filesystem POIFSDocument POIFSDocument

List of usage examples for org.apache.poi.poifs.filesystem POIFSDocument POIFSDocument

Introduction

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

Prototype

public POIFSDocument(String name, POIFSFileSystem filesystem, InputStream stream) throws IOException 

Source Link

Document

Constructor for a new Document

Usage

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

License:Apache License

private void processProperties(final BlockList small_blocks, final BlockList big_blocks,
        final Iterator<Property> properties, final POIFSDocumentPath path) throws IOException {

    while (properties.hasNext()) {
        Property property = properties.next();
        String name = property.getName();

        if (property.isDirectory()) {

            POIFSDocumentPath new_path = new POIFSDocumentPath(path, new String[] { name });

            readerListener.processPOIFSReaderEvent(new AAFReaderEvent(null, path, property));

            processProperties(small_blocks, big_blocks, ((DirectoryProperty) property).getChildren(), new_path);

            readerListener.processDirectoryEnd();
        } else {//  w w  w. jav a  2s  .  c o m
            int startBlock = property.getStartBlock();

            if (readerListener != null) {
                int size = property.getSize();
                POIFSDocument document = null;

                if (property.shouldUseSmallBlocks()) {
                    document = new POIFSDocument(name, small_blocks.fetchBlocks(startBlock, -1), size);
                } else {
                    document = new POIFSDocument(name, big_blocks.fetchBlocks(startBlock, -1), size);
                }

                readerListener.processPOIFSReaderEvent(
                        new AAFReaderEvent(new DocumentInputStream(document), path, property));
            } else {

                // consume the document's data and discard it
                if (property.shouldUseSmallBlocks()) {
                    small_blocks.fetchBlocks(startBlock, -1);
                } else {
                    big_blocks.fetchBlocks(startBlock, -1);
                }
            }
        }
    }
}