aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/poi/poifs/filesystem
diff options
context:
space:
mode:
authorNick Burch <nick@apache.org>2010-12-30 00:58:28 +0000
committerNick Burch <nick@apache.org>2010-12-30 00:58:28 +0000
commitf02e062521ea73e59dd5e95a52cb6a71b0f77c1d (patch)
tree7ce7686ac89498b2fc768bb58348ef5abfb3dcaf /src/java/org/apache/poi/poifs/filesystem
parentd004673137ef3f80e55f6438ae998b04734ace35 (diff)
downloadpoi-f02e062521ea73e59dd5e95a52cb6a71b0f77c1d.tar.gz
poi-f02e062521ea73e59dd5e95a52cb6a71b0f77c1d.zip
NPOIFS needs an explicit close, as it has to keep the File / buffer around to read from. Adds a close method
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1053777 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/poi/poifs/filesystem')
-rw-r--r--src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java b/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java
index b506e4b9aa..e671d870bb 100644
--- a/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java
+++ b/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java
@@ -107,7 +107,11 @@ public class NPOIFSFileSystem extends BlockStore
/**
* Creates a POIFSFileSystem from a <tt>File</tt>. This uses less memory than
- * creating from an <tt>InputStream</tt>
+ * creating from an <tt>InputStream</tt>.
+ *
+ * Note that with this constructor, you will need to call {@link #close()}
+ * when you're done to have the underlying file closed, as the file is
+ * kept open during normal operation to read the data out.
*
* @param file the File from which to read the data
*
@@ -625,6 +629,15 @@ public class NPOIFSFileSystem extends BlockStore
new NPOIFSStream(this, _header.getPropertyStart())
);
}
+
+ /**
+ * Closes the FileSystem, freeing any underlying files, streams
+ * and buffers. After this, you will be unable to read or
+ * write from the FileSystem.
+ */
+ public void close() throws IOException {
+ _data.close();
+ }
/**
* read in a file and write it back out again