Package org.apache.poi.poifs.property

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


     */

    public DirectoryEntry createDirectory(final String name)
        throws IOException
    {
        DirectoryProperty property = new DirectoryProperty(name);
        DirectoryNode     rval     = new DirectoryNode(property, _filesystem,
                                         this);

        (( DirectoryProperty ) getProperty()).addChild(property);
        _filesystem.addDirectory(property);
View Full Code Here


    public void testEmptyConstructor()
        throws IOException
    {
        POIFSFileSystem   fs        = new POIFSFileSystem();
        DirectoryProperty property1 = new DirectoryProperty("parent");
        DirectoryProperty property2 = new DirectoryProperty("child");
        DirectoryNode     parent    = new DirectoryNode(property1, fs, null);
        DirectoryNode     node      = new DirectoryNode(property2, fs,
                                          parent);

        assertEquals(0, parent.getPath().length());
        assertEquals(1, node.getPath().length());
        assertEquals("child", node.getPath().getComponent(0));

        // verify that getEntries behaves correctly
        int      count = 0;
        Iterator iter  = node.getEntries();

        while (iter.hasNext())
        {
            count++;
            iter.next();
        }
        assertEquals(0, count);

        // verify behavior of isEmpty
        assertTrue(node.isEmpty());

        // verify behavior of getEntryCount
        assertEquals(0, node.getEntryCount());

        // verify behavior of getEntry
        try
        {
            node.getEntry("foo");
            fail("should have caught FileNotFoundException");
        }
        catch (FileNotFoundException ignored)
        {

            // as expected
        }

        // verify behavior of isDirectoryEntry
        assertTrue(node.isDirectoryEntry());

        // verify behavior of getName
        assertEquals(property2.getName(), node.getName());

        // verify behavior of isDocumentEntry
        assertTrue(!node.isDocumentEntry());

        // verify behavior of getParent
View Full Code Here

     */

    public void testNonEmptyConstructor()
        throws IOException
    {
        DirectoryProperty property1 = new DirectoryProperty("parent");
        DirectoryProperty property2 = new DirectoryProperty("child1");

        property1.addChild(property2);
        property1.addChild(new DocumentProperty("child2", 2000));
        property2.addChild(new DocumentProperty("child3", 30000));
        DirectoryNode node  = new DirectoryNode(property1,
                                                new POIFSFileSystem(), null);

        // verify that getEntries behaves correctly
        int           count = 0;
View Full Code Here

        DirectoryEntry root = fs.getRoot();
        DirectoryEntry vba_project = (DirectoryEntry)root.getEntry(_VBA_PROJECT_CUR);

        DirectoryNode vba = (DirectoryNode)vba_project.getEntry(VBA);
        DirectoryProperty  p = (DirectoryProperty)vba.getProperty();

        ArrayList lst = new ArrayList();
        for (Iterator it = p.getChildren(); it.hasNext();){
            Property ch = (Property)it.next();
            lst.add(ch);
        }
        return (Property [])lst.toArray(new Property[ 0 ]);
    }
View Full Code Here

                                                   _workbook_size);

        _workbook = new DocumentNode(
            document.getDocumentProperty(),
            new DirectoryNode(
                new DirectoryProperty("Root Entry"), null, null));
    }
View Full Code Here

     */

    public void testConstructor()
        throws IOException
    {
        DirectoryProperty    property1 = new DirectoryProperty("directory");
        RawDataBlock[]       rawBlocks = new RawDataBlock[ 4 ];
        ByteArrayInputStream stream    =
            new ByteArrayInputStream(new byte[ 2048 ]);

        for (int j = 0; j < 4; j++)
View Full Code Here

     */

    public DirectoryEntry createDirectory(final String name)
        throws IOException
    {
        DirectoryProperty property = new DirectoryProperty(name);
        DirectoryNode     rval     = new DirectoryNode(property, _filesystem,
                                         this);

        (( DirectoryProperty ) getProperty()).addChild(property);
        _filesystem.addDirectory(property);
View Full Code Here

                                                   _workbook_size);

        _workbook = new DocumentNode(
            document.getDocumentProperty(),
            new DirectoryNode(
                new DirectoryProperty("Root Entry"), (POIFSFileSystem)null, null));
    }
View Full Code Here

            Property child     = iter.next();
            Entry    childNode = null;

            if (child.isDirectory())
            {
                DirectoryProperty childDir = (DirectoryProperty) child;
                if(_ofilesystem != null) {
                   childNode = new DirectoryNode(childDir, _ofilesystem, this);
                } else {
                   childNode = new DirectoryNode(childDir, _nfilesystem, this);
                }
View Full Code Here

    public DirectoryEntry createDirectory(final String name)
        throws IOException
    {
        DirectoryNode rval;
        DirectoryProperty property = new DirectoryProperty(name);
       
        if(_ofilesystem != null) {
           rval = new DirectoryNode(property, _ofilesystem, this);
           _ofilesystem.addDirectory(property);
        } else {
View Full Code Here

TOP

Related Classes of org.apache.poi.poifs.property.DirectoryProperty

Copyright © 2018 www.massapicom. 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.