Package org.apache.poi.poifs.filesystem

Examples of org.apache.poi.poifs.filesystem.POIFSFileSystem.writeFilesystem()


        /* Write the POI filesystem to a (temporary) file <em>doc2</em>
         * and close the latter. */
        final File doc2 = TempFile.createTempFile("POI_HPSF_Test.", ".tmp");
        doc2.deleteOnExit();
        OutputStream out = new FileOutputStream(doc2);
        poifs.writeFilesystem(out);
        out.close();

        /*
         * Open <em>doc2</em> for reading and check summary information and
         * document summary information. All properties written before must be
View Full Code Here


         * <li><p>Write the POI filesystem to a (temporary) file <em>doc3</em>
         * and close the latter. */
        final File doc3 = TempFile.createTempFile("POI_HPSF_Test.", ".tmp");
        doc3.deleteOnExit();
        out = new FileOutputStream(doc3);
        poifs.writeFilesystem(out);
        out.close();

        /*
         * Open <em>doc3</em> for reading and check summary information
         * and document summary information. All properties removed before must not
View Full Code Here

    // Write them out
    POIFSFileSystem outFS = new POIFSFileSystem();
    doc.readProperties();
    doc.writeProperties(outFS);
    outFS.writeFilesystem(baos);

    // Create a new version
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    POIFSFileSystem inFS = new POIFSFileSystem(bais);
View Full Code Here

        OutputStream os = e.getDataStream(fs);
        IOUtils.copy(new ByteArrayInputStream(payloadExpected), os);
        os.close();

        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        fs.writeFilesystem(bos);
       
        nfs = new NPOIFSFileSystem(new ByteArrayInputStream(bos.toByteArray()));
        infoActual = new EncryptionInfo(nfs.getRoot());
        Decryptor decActual = Decryptor.getInstance(infoActual);
        passed = decActual.verifyPassword(pass);       
View Full Code Here

        OutputStream os = e.getDataStream(fs);
        IOUtils.copy(new ByteArrayInputStream(payloadExpected), os);
        os.close();
       
        bos.reset();
        fs.writeFilesystem(bos);

        ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
       
        // FileOutputStream fos = new FileOutputStream("encrypted.docx");
        // IOUtils.copy(bis, fos);
View Full Code Here

        assertTrue(Arrays.equals(ole10.getDataBuffer(), bos.toByteArray()));

        od = wb.getAllEmbeddedObjects().get(1);
        ole10 = Ole10Native.createFromEmbeddedOleObject((DirectoryNode)od.getDirectory());
        bos.reset();
        xlsPoifs.writeFilesystem(bos);
        assertTrue(Arrays.equals(ole10.getDataBuffer(), bos.toByteArray()));

        od = wb.getAllEmbeddedObjects().get(2);
        ole10 = Ole10Native.createFromEmbeddedOleObject((DirectoryNode)od.getDirectory());
        assertTrue(Arrays.equals(ole10.getDataBuffer(), getSampleTXT()));
View Full Code Here

        if (preserveNodes) {
            List excepts = new ArrayList(1);
            excepts.add("Workbook");
            copyNodes(this.poifs,fs,excepts);
        }
        fs.writeFilesystem(stream);
        //poifs.writeFilesystem(stream);
    }

    /**
     * Method getBytes - get the bytes of just the HSSF portions of the XLS file.
View Full Code Here

        if (preserveNodes) {
            List excepts = new ArrayList(1);
            excepts.add("Workbook");
            copyNodes(this.poifs,fs,excepts);
        }
        fs.writeFilesystem(stream);
        //poifs.writeFilesystem(stream);
    }

    /**
     * Method getBytes - get the bytes of just the HSSF portions of the XLS file.
View Full Code Here

        OutputStream os = enc.getDataStream(fs);
        IOUtils.copy(new ByteArrayInputStream(byteExpected), os);
        os.close();
       
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        fs.writeFilesystem(bos);
        bos.close();
       
        fs = new POIFSFileSystem(new ByteArrayInputStream(bos.toByteArray()));
        info = new EncryptionInfo(fs);
        AgileDecryptor agDec = (AgileDecryptor)info.getDecryptor();
View Full Code Here

            // YK: preserve StorageClsid, it is important for embedded workbooks,
            // see Bugzilla 47920
            fs.getRoot().setStorageClsid(this.directory.getStorageClsid());
        }
        fs.writeFilesystem(stream);
    }

    /**
     * Totals the sizes of all sheet records and eventually serializes them
     */
 
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.