/** * Writes out a given PropertySet * * @param name the (POIFS Level) name of the property to write * @param set the PropertySet to write out * @param outFS the NPOIFSFileSystem to write the property into * * @throws IOException if an error when writing to the * {@link POIFSFileSystem} occurs */ private void writePropertySet(String name, PropertySet set, POIFSFileSystem outFS) throws IOException { try { PropertySet mSet = new PropertySet(set); ByteArrayOutputStream bOut = new ByteArrayOutputStream(); mSet.write(bOut); byte[] data = bOut.toByteArray(); ByteArrayInputStream bIn = new ByteArrayInputStream(data); // Create or Update the Property Set stream in the POIFS outFS.createOrUpdateDocument(bIn, name); logger.log(POILogger.INFO, "Wrote property set " + name + " of size " + data.length); } catch(WritingNotSupportedException ignored) { logger.log( POILogger.ERROR, "Couldn't write property set with name " + name + " as not supported by HPSF yet"); } }
private static void write(POIFSFileSystem pfs, byte[] data, String name) throws IOException { pfs.createOrUpdateDocument(new ByteArrayInputStream(data), name); }
/** * Writes ourselves back out to a filesystem */ public void writeToFS(POIFSFileSystem fs) throws IOException { // Grab contents ByteArrayOutputStream baos = new ByteArrayOutputStream(); writeOut(baos); ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); // Write out fs.createOrUpdateDocument(bais,"Current User"); } }
/** * Writes out a given PropertySet * * @param name the (POIFS Level) name of the property to write * @param set the PropertySet to write out * @param outFS the NPOIFSFileSystem to write the property into * * @throws IOException if an error when writing to the * {@link POIFSFileSystem} occurs */ private void writePropertySet(String name, PropertySet set, POIFSFileSystem outFS) throws IOException { try { PropertySet mSet = new PropertySet(set); ByteArrayOutputStream bOut = new ByteArrayOutputStream(); mSet.write(bOut); byte[] data = bOut.toByteArray(); ByteArrayInputStream bIn = new ByteArrayInputStream(data); // Create or Update the Property Set stream in the POIFS outFS.createOrUpdateDocument(bIn, name); logger.log(POILogger.INFO, "Wrote property set " + name + " of size " + data.length); } catch(WritingNotSupportedException ignored) { logger.log( POILogger.ERROR, "Couldn't write property set with name " + name + " as not supported by HPSF yet"); } }
outFS.createOrUpdateDocument(bais, POWERPOINT_DOCUMENT); writtenEntries.add(POWERPOINT_DOCUMENT); encryptedSS.encryptPicture(pict.getBuf(), offset); outFS.createOrUpdateDocument( new ByteArrayInputStream(pict.getBuf(), 0, pict.size()), "Pictures" );