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

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

Introduction

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

Prototype


public POIFSDocumentPath(final POIFSDocumentPath path, final String[] components)
        throws IllegalArgumentException 

Source Link

Document

constructor that adds additional subdirectories to an existing path

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  ww  .  j ava 2s  .co  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);
                }
            }
        }
    }
}