use of org.apache.poi.poifs.filesystem.POIFSFileSystem in project poi by apache.
the class HSLFSlideShowImpl method write.
/**
* Writes out the slideshow file the is represented by an instance
* of this class.
* If you require all streams to be written out (eg Marcos, embeded
* documents), then set <code>preserveNodes</code> set to <code>true</code>
*
* @param newFile The File to write to.
* @param preserveNodes Should all OLE2 streams be written back out, or only the common ones?
* @throws IOException If there is an unexpected IOException from writing to the File
*/
public void write(File newFile, boolean preserveNodes) throws IOException {
// Get a new FileSystem to write into
POIFSFileSystem outFS = POIFSFileSystem.create(newFile);
try {
// Write into the new FileSystem
write(outFS, preserveNodes);
// Send the POIFSFileSystem object out to the underlying stream
outFS.writeFilesystem();
} finally {
outFS.close();
}
}
use of org.apache.poi.poifs.filesystem.POIFSFileSystem in project poi by apache.
the class TestPOIDocumentScratchpad method testWriteReadProperties.
@Test
public void testWriteReadProperties() throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
// Write them out
NPOIFSFileSystem outFS = new NPOIFSFileSystem();
doc.writeProperties(outFS);
outFS.writeFilesystem(baos);
// Create a new version
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
POIFSFileSystem inFS = new POIFSFileSystem(bais);
// Check they're still there
POIDocument ppt = new HPSFPropertiesOnlyDocument(inFS);
ppt.readProperties();
// Delegate test
testReadPropertiesHelper(ppt);
ppt.close();
inFS.close();
}
use of org.apache.poi.poifs.filesystem.POIFSFileSystem in project poi by apache.
the class TestHDGFCore method DISABLEDtestAIOOB.
/**
* Tests that we can open a problematic file that triggers
* an ArrayIndexOutOfBoundsException when processing the
* chunk commands.
* @throws Exception
*/
public void DISABLEDtestAIOOB() throws Exception {
fs = new POIFSFileSystem(_dgTests.openResourceAsStream("44501.vsd"));
hdgf = new HDGFDiagram(fs);
assertNotNull(hdgf);
}
use of org.apache.poi.poifs.filesystem.POIFSFileSystem in project poi by apache.
the class TestStreamBugs method setUp.
@Before
public void setUp() throws IOException {
ptrFactory = new PointerFactory(11);
chunkFactory = new ChunkFactory(11);
InputStream is = POIDataSamples.getDiagramInstance().openResourceAsStream("44594.vsd");
filesystem = new POIFSFileSystem(is);
is.close();
// Grab the document stream
InputStream is2 = filesystem.createDocumentInputStream("VisioDocument");
contents = IOUtils.toByteArray(is2);
is2.close();
}
use of org.apache.poi.poifs.filesystem.POIFSFileSystem in project poi by apache.
the class TestStreamComplex method setUp.
@Before
public void setUp() throws IOException {
ptrFactory = new PointerFactory(11);
chunkFactory = new ChunkFactory(11);
InputStream is = POIDataSamples.getDiagramInstance().openResourceAsStream("Test_Visio-Some_Random_Text.vsd");
POIFSFileSystem filesystem = new POIFSFileSystem(is);
is.close();
// Grab the document stream
InputStream is2 = filesystem.createDocumentInputStream("VisioDocument");
contents = IOUtils.toByteArray(is2);
is2.close();
filesystem.close();
}
Aggregations