aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java')
-rw-r--r--src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java b/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java
index e81888d06f..f987c43b31 100644
--- a/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java
+++ b/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java
@@ -689,8 +689,6 @@ public class NPOIFSFileSystem extends BlockStore
return getRoot().createDocument(name, stream);
}
- // TODO Add a createOrUpdateDocument method to simplify code
-
/**
* create a new DocumentEntry in the root entry; the data will be
* provided later
@@ -728,6 +726,26 @@ public class NPOIFSFileSystem extends BlockStore
}
/**
+ * Set the contents of a document in the root directory,
+ * creating if needed, otherwise updating
+ *
+ * @param stream the InputStream from which the document's data
+ * will be obtained
+ * @param name the name of the new or existing POIFSDocument
+ *
+ * @return the new or updated DocumentEntry
+ *
+ * @exception IOException on error populating the POIFSDocument
+ */
+
+ public DocumentEntry createOrUpdateDocument(final InputStream stream,
+ final String name)
+ throws IOException
+ {
+ return getRoot().createOrUpdateDocument(name, stream);
+ }
+
+ /**
* Does the filesystem support an in-place write via
* {@link #writeFilesystem()} ? If false, only writing out to
* a brand new file via {@link #writeFilesystem(OutputStream)}