Example usage for org.apache.poi.poifs.property Property getStartBlock

List of usage examples for org.apache.poi.poifs.property Property getStartBlock

Introduction

In this page you can find the example usage for org.apache.poi.poifs.property Property getStartBlock.

Prototype

public int getStartBlock() 

Source Link

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 {//from   ww  w .  j  a v a2  s.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);
                }
            }
        }
    }
}