diff --git a/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java b/src/java/org/apache/poi/poifs/filesystem/NPOIFSFileSystem.java index b506e4b9a..e671d870b 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 File. This uses less memory than - * creating from an InputStream + * creating from an InputStream. + * + * 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