*
* @throws IOException thrown on errors writing to the file
*/
- //public abstract void write() throws IOException; // TODO Implement elsewhere
+ public abstract void write() throws IOException;
/**
* Writes the document out to the specified new {@link File}. If the file
*
* @throws IOException thrown on errors writing to the file
*/
- //public abstract void write(File newFile) throws IOException; // TODO Implement elsewhere
+ public abstract void write(File newFile) throws IOException;
/**
* Writes the document out to the specified output stream. The
==================================================================== */
package org.apache.poi.hpsf;
+import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
super(fs);
}
+ /**
+ * Write out to the currently open file the properties changes, but nothing else
+ */
+ public void write() throws IOException {
+ NPOIFSFileSystem fs = directory.getFileSystem();
+
+ validateInPlaceWritePossible();
+ writeProperties(fs, null);
+ fs.writeFilesystem();
+ }
+ /**
+ * Write out, with any properties changes, but nothing else
+ */
+ public void write(File newFile) throws IOException {
+ POIFSFileSystem fs = POIFSFileSystem.create(newFile);
+ write(fs);
+ fs.writeFilesystem();
+ }
/**
* Write out, with any properties changes, but nothing else
*/
public void write(OutputStream out) throws IOException {
NPOIFSFileSystem fs = new NPOIFSFileSystem();
-
+ write(fs);
+ fs.writeFilesystem(out);
+ }
+
+ private void write(NPOIFSFileSystem fs) throws IOException {
// For tracking what we've written out, so far
- List<String> excepts = new ArrayList<String>(1);
+ List<String> excepts = new ArrayList<String>(2);
// Write out our HPFS properties, with any changes
writeProperties(fs, excepts);
// Copy over everything else unchanged
EntryUtils.copyNodes(directory, fs.getRoot(), excepts);
- // Save the resultant POIFSFileSystem to the output stream
- fs.writeFilesystem(out);
+ // Caller will save the resultant POIFSFileSystem to the stream/file
}
}
* you must use {@link #write(OutputStream)} or {@link #write(File)} to
* write to a brand new document.
*/
- //@Override // TODO Not yet on POIDocument
+ @Override
public void write() throws IOException {
validateInPlaceWritePossible();
* @exception IOException if anything can't be written.
* @see org.apache.poi.poifs.filesystem.POIFSFileSystem
*/
- //@Override // TODO Not yet on POIDocument
+ @Override
public void write(File newFile) throws IOException {
POIFSFileSystem fs = POIFSFileSystem.create(newFile);
try {
/**
* Note - writing is not yet supported for this file format, sorry.
*/
-// @Override
-// public void write() throws IOException {
-// throw new IllegalStateException("Writing is not yet implemented for this Document Format");
-// }
+ @Override
+ public void write() throws IOException {
+ throw new IllegalStateException("Writing is not yet implemented for this Document Format");
+ }
/**
* Note - writing is not yet supported for this file format, sorry.
*/
-// @Override
-// public void write(File file) throws IOException {
-// throw new IllegalStateException("Writing is not yet implemented for this Document Format");
-// }
+ @Override
+ public void write(File file) throws IOException {
+ throw new IllegalStateException("Writing is not yet implemented for this Document Format");
+ }
/**
* Note - writing is not yet supported for this file format, sorry.
*/
}
currentUser.setCurrentEditOffset(usr.getLastOnDiskOffset());
}
+
+ @Override
+ public void write() throws IOException {
+ throw new IllegalStateException("Coming soon!");
+ }
+ @Override
+ public void write(File newFile) throws IOException {
+ throw new IllegalStateException("Coming soon!");
+ }
/**
* Writes out the slideshow file the is represented by an instance
* @throws IOException If there is an unexpected IOException from
* the passed in OutputStream
*/
+ @Override
public void write(OutputStream out) throws IOException {
// Write out, but only the common streams
write(out,false);
package org.apache.poi.hwpf;
import java.io.ByteArrayInputStream;
+import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
return _fields;
}
+ @Override
+ public void write() throws IOException {
+ throw new IllegalStateException("Coming soon!");
+ }
+ @Override
+ public void write(File newFile) throws IOException {
+ throw new IllegalStateException("Coming soon!");
+ }
+
/**
* Writes out the word file that is represented by an instance of this class.
*
==================================================================== */
package org.apache.poi.hwpf;
+import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
return _text;
}
+ @Override
+ public void write() throws IOException {
+ throw new IllegalStateException("Writing is not available for the older file formats");
+ }
+ @Override
+ public void write(File out) throws IOException {
+ throw new IllegalStateException("Writing is not available for the older file formats");
+ }
@Override
public void write(OutputStream out) throws IOException {
throw new IllegalStateException("Writing is not available for the older file formats");