diff --git a/src/documentation/content/xdocs/poifs/how-to.xml b/src/documentation/content/xdocs/poifs/how-to.xml index e1bc8c2c61..5e107070d1 100644 --- a/src/documentation/content/xdocs/poifs/how-to.xml +++ b/src/documentation/content/xdocs/poifs/how-to.xml @@ -27,12 +27,9 @@
This document describes how to use the POIFS APIs to read, write, and modify files that employ a POIFS-compatible data structure to organize their content.
-This document describes how to use the POIFS APIs to read, write, + and modify files that employ a POIFS-compatible data structure to + organize their content.
This document is intended for Java developers who need to use the POIFS APIs to read, write, or modify files that employ a POIFS-compatible data structure to organize their content. It is not necessary for developers to understand the POIFS data structures, and an explanation of those data structures is beyond the scope of this document. It is expected that the members of the target audience will understand the rudiments of a hierarchical file system, and familiarity with the event pattern employed by Java APIs such as AWT would be helpful.
Once the file system has been loaded into memory and the root directory has been obtained, the root directory can be read. The following code fragment shows how to read the entries in an org.apache.poi.poifs.filesystem.DirectoryEntry instance:
In this technique for reading, certain key structures are loaded + into memory, and the entire directory tree can be walked by the + application, reading specific documents at leisure.
+If you create a NPOIFSFileSystem instance from a File, the memory + footprint is very small. However, if you createa a NPOIFSFileSystem + instance from an input stream, then the whole contents must be + buffered into memory to allow random access. As such, you should + budget on memory use of up to 20% of the file size when using a File, + or up to 120% of the file size when using an InputStream.
+Before an application can read a file from the file system, the
+ file system needs to be opened and core parts processed. This is done
+ using the org.apache.poi.poifs.filesystem.NPOIFSFileSystem
+ class. Once the file system has been loaded into memory, the
+ application may need the root directory. The following code fragment
+ will accomplish this preparation stage:
Assuming no exception was thrown, the file system can then be read.
+One the NPOFSFileSytem is open, you can manipulate it just like + a POIFSFileSytem one.
+The event-driven API for reading documents is a little more complicated and requires that your application know, in advance, which files it wants to read. The benefit of using this API is that each document is in memory just long enough for your application to read it, and documents that you never read at all are not in memory at all. When you're finished reading the documents you wanted, the file system has no data structures associated with it at all and can be discarded.