/** * Write the filesystem out * * @param stream the OutputStream to which the filesystem will be written * @exception IOException thrown on errors writing to the stream */ public void writeFilesystem(final OutputStream stream) throws IOException { // Have the datasource updated syncWithDataSource(); // Now copy the contents to the stream _data.copyTo(stream); }
/** * Write the filesystem out to the open file. Will thrown an {@link IllegalArgumentException} if * opened from an {@link InputStream}. * * @exception IOException thrown on errors writing to the stream */ public void writeFilesystem() throws IOException { if (_data instanceof FileBackedDataSource) { // Good, correct type } else { throw new IllegalArgumentException( "POIFS opened from an inputstream, so writeFilesystem() may " + "not be called. Use writeFilesystem(OutputStream) instead"); } syncWithDataSource(); }