Examples of RootProperty


Examples of org.apache.poi.poifs.property.RootProperty

        // table
        new BlockAllocationTableReader(1, bat_array, 0, -2, data_blocks);

        // get property table from the document
        PropertyTable properties = new PropertyTable(0, data_blocks);
        RootProperty  root       = properties.getRoot();
        BlockList     bl         =
            SmallBlockTableReader.getSmallDocumentBlocks(data_blocks, root,
                14);
    }
View Full Code Here

Examples of org.apache.poi.poifs.property.RootProperty

            .add(new POIFSDocument("doc8",
                                   new ByteArrayInputStream(new byte[ 8 ])));
        documents
            .add(new POIFSDocument("doc9",
                                   new ByteArrayInputStream(new byte[ 9 ])));
        RootProperty               root = new PropertyTable().getRoot();
        SmallBlockTableWriter      sbtw = new SmallBlockTableWriter(documents,
                                              root);
        BlockAllocationTableWriter bat  = sbtw.getSBAT();

        // 15 small blocks: 6 for doc340, 0 for doc5000 (too big), 0
        // for doc0 (no storage needed), 1 each for doc1 through doc9
        assertEquals(15 * 64, root.getSize());

        // 15 small blocks rounds up to 2 big blocks
        assertEquals(2, sbtw.countBlocks());
        int start_block = 1000 + root.getStartBlock();

        sbtw.setStartBlock(start_block);
        assertEquals(start_block, root.getStartBlock());
    }
View Full Code Here

Examples of org.apache.poi.poifs.property.RootProperty

         NPropertyTable props = fs._get_property_table();
         assertEquals(90, props.getStartBlock());
         assertEquals(7, props.countBlocks());
        
         // Root property tells us about the Mini Stream
         RootProperty root = props.getRoot();
         assertEquals("Root Entry", root.getName());
         assertEquals(11564, root.getSize());
         assertEquals(0, root.getStartBlock());
        
         // Check its children too
         Property prop;
         Iterator<Property> pi = root.getChildren();
         prop = pi.next();
         assertEquals("Thumbnail", prop.getName());
         prop = pi.next();
         assertEquals("\u0005DocumentSummaryInformation", prop.getName());
         prop = pi.next();
         assertEquals("\u0005SummaryInformation", prop.getName());
         prop = pi.next();
         assertEquals("Image", prop.getName());
         prop = pi.next();
         assertEquals("Tags", prop.getName());
         assertEquals(false, pi.hasNext());
        
        
         // Check the SBAT (Small Blocks FAT) was properly processed
         NPOIFSMiniStore ministore = fs.getMiniStore();
        
         // Verify we only got two SBAT blocks
         ministore.getBATBlockAndIndex(0);
         ministore.getBATBlockAndIndex(128);
         try {
            ministore.getBATBlockAndIndex(256);
            fail("Should only be two SBATs, but a 3rd was found");
         } catch(IndexOutOfBoundsException e) {}
        
         // Verify a few offsets: 0->50 is a stream
         for(int i=0; i<50; i++) {
            assertEquals(i+1, ministore.getNextBlock(i));
         }
         assertEquals(POIFSConstants.END_OF_CHAIN, ministore.getNextBlock(50));
        
         fs.close();
      }
     
      // Now with a simple 4096 block file
      fsA = new NPOIFSFileSystem(_inst.getFile("BlockSize4096.zvi"));
      fsB = new NPOIFSFileSystem(_inst.openResourceAsStream("BlockSize4096.zvi"));
      for(NPOIFSFileSystem fs : new NPOIFSFileSystem[] {fsA,fsB}) {
         // Check the FAT was properly processed
         // Verify we only got one block
         fs.getBATBlockAndIndex(0);
         fs.getBATBlockAndIndex(1);
         try {
            fs.getBATBlockAndIndex(1040);
            fail("Should only be one BAT, but a 2nd was found");
         } catch(IndexOutOfBoundsException e) {}
        
         // Verify a few next offsets
         // 0 -> 1 -> 2 -> END
         assertEquals(1, fs.getNextBlock(0));
         assertEquals(2, fs.getNextBlock(1));
         assertEquals(POIFSConstants.END_OF_CHAIN, fs.getNextBlock(2));

        
         // Check the properties
         NPropertyTable props = fs._get_property_table();
         assertEquals(12, props.getStartBlock());
         assertEquals(1, props.countBlocks());
        
         // Root property tells us about the Mini Stream
         RootProperty root = props.getRoot();
         assertEquals("Root Entry", root.getName());
         assertEquals(11564, root.getSize());
         assertEquals(0, root.getStartBlock());
        
         // Check its children too
         Property prop;
         Iterator<Property> pi = root.getChildren();
         prop = pi.next();
         assertEquals("Thumbnail", prop.getName());
         prop = pi.next();
         assertEquals("\u0005DocumentSummaryInformation", prop.getName());
         prop = pi.next();
View Full Code Here

Examples of org.apache.poi.poifs.property.RootProperty

            .add(new POIFSDocument("doc8",
                                   new ByteArrayInputStream(new byte[ 8 ])));
        documents
            .add(new POIFSDocument("doc9",
                                   new ByteArrayInputStream(new byte[ 9 ])));
        RootProperty               root = new PropertyTable().getRoot();
        SmallBlockTableWriter      sbtw = new SmallBlockTableWriter(documents,
                                              root);
        BlockAllocationTableWriter bat  = sbtw.getSBAT();

        // 15 small blocks: 6 for doc340, 0 for doc5000 (too big), 0
        // for doc0 (no storage needed), 1 each for doc1 through doc9
        assertEquals(15 * 64, root.getSize());

        // 15 small blocks rounds up to 2 big blocks
        assertEquals(2, sbtw.countBlocks());
        int start_block = 1000 + root.getStartBlock();

        sbtw.setStartBlock(start_block);
        assertEquals(start_block, root.getStartBlock());
    }
View Full Code Here

Examples of org.apache.poi.poifs.property.RootProperty

        // table
        new BlockAllocationTableReader(1, bat_array, 0, -2, data_blocks);

        // get property table from the document
        PropertyTable properties = new PropertyTable(0, data_blocks);
        RootProperty  root       = properties.getRoot();
        BlockList     bl         =
            SmallBlockTableReader.getSmallDocumentBlocks(data_blocks, root,
                14);
    }
View Full Code Here

Examples of org.apache.poi.poifs.property.RootProperty

        // table
        new BlockAllocationTableReader(1, bat_array, 0, -2, data_blocks);

        // get property table from the document
        PropertyTable properties = new PropertyTable(0, data_blocks);
        RootProperty  root       = properties.getRoot();
        BlockList     bl         =
            SmallBlockTableReader.getSmallDocumentBlocks(data_blocks, root,
                14);
    }
View Full Code Here

Examples of org.apache.poi.poifs.property.RootProperty

            .add(new POIFSDocument("doc8",
                                   new ByteArrayInputStream(new byte[ 8 ])));
        documents
            .add(new POIFSDocument("doc9",
                                   new ByteArrayInputStream(new byte[ 9 ])));
        RootProperty               root = new PropertyTable().getRoot();
        SmallBlockTableWriter      sbtw = new SmallBlockTableWriter(documents,
                                              root);
        BlockAllocationTableWriter bat  = sbtw.getSBAT();

        // 15 small blocks: 6 for doc340, 0 for doc5000 (too big), 0
        // for doc0 (no storage needed), 1 each for doc1 through doc9
        assertEquals(15 * 64, root.getSize());

        // 15 small blocks rounds up to 2 big blocks
        assertEquals(2, sbtw.countBlocks());
        int start_block = 1000 + root.getStartBlock();

        sbtw.setStartBlock(start_block);
        assertEquals(start_block, root.getStartBlock());
    }
View Full Code Here

Examples of org.apache.poi.poifs.property.RootProperty

    // table
    new BlockAllocationTableReader(1, bat_array, 0, -2, data_blocks);

    // get property table from the document
    PropertyTable properties = new PropertyTable(0, data_blocks);
    RootProperty root = properties.getRoot();
    BlockList bl = SmallBlockTableReader.getSmallDocumentBlocks(data_blocks, root, 14);
    assertNotNull(bl);
  }
View Full Code Here

Examples of org.apache.poi.poifs.property.RootProperty

        // table
        new BlockAllocationTableReader(1, bat_array, 0, -2, data_blocks);

        // get property table from the document
        PropertyTable properties = new PropertyTable(0, data_blocks);
        RootProperty  root       = properties.getRoot();
        BlockList     bl         =
            SmallBlockTableReader.getSmallDocumentBlocks(data_blocks, root,
                14);
    }
View Full Code Here

Examples of org.apache.poi.poifs.property.RootProperty

            .add(new POIFSDocument("doc8",
                                   new ByteArrayInputStream(new byte[ 8 ])));
        documents
            .add(new POIFSDocument("doc9",
                                   new ByteArrayInputStream(new byte[ 9 ])));
        RootProperty               root = new PropertyTable().getRoot();
        SmallBlockTableWriter      sbtw = new SmallBlockTableWriter(documents,
                                              root);
        BlockAllocationTableWriter bat  = sbtw.getSBAT();

        // 15 small blocks: 6 for doc340, 0 for doc5000 (too big), 0
        // for doc0 (no storage needed), 1 each for doc1 through doc9
        assertEquals(15 * 64, root.getSize());

        // 15 small blocks rounds up to 2 big blocks
        assertEquals(2, sbtw.countBlocks());
        int start_block = 1000 + root.getStartBlock();

        sbtw.setStartBlock(start_block);
        assertEquals(start_block, root.getStartBlock());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.