Class POIFSReader
java.lang.Object
org.docx4j.org.apache.poi.poifs.eventfilesystem.POIFSReader
An event-driven reader for POIFS file systems. Users of this class
first create an instance of it, then use the registerListener
methods to register POIFSReaderListener instances for specific
documents. Once all the listeners have been registered, the read()
method is called, which results in the listeners being notified as
their documents are read.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidread in filesprivate voidprocessProperties(BlockList small_blocks, BlockList big_blocks, Iterator properties, POIFSDocumentPath path) voidread(InputStream stream) Read from an InputStream and process the documents we getvoidregisterListener(POIFSReaderListener listener) Register a POIFSReaderListener for all documentsvoidregisterListener(POIFSReaderListener listener, String name) Register a POIFSReaderListener for a document in the root directoryvoidregisterListener(POIFSReaderListener listener, POIFSDocumentPath path, String name) Register a POIFSReaderListener for a document in the specified directory
-
Field Details
-
registry
-
registryClosed
private boolean registryClosed
-
-
Constructor Details
-
POIFSReader
public POIFSReader()Create a POIFSReader
-
-
Method Details
-
read
Read from an InputStream and process the documents we get- Parameters:
stream- the InputStream from which to read the data- Throws:
IOException- on errors reading, or on invalid data
-
registerListener
Register a POIFSReaderListener for all documents- Parameters:
listener- the listener to be registered- Throws:
NullPointerException- if listener is nullIllegalStateException- if read() has already been called
-
registerListener
Register a POIFSReaderListener for a document in the root directory- Parameters:
listener- the listener to be registeredname- the document name- Throws:
NullPointerException- if listener is null or name is null or emptyIllegalStateException- if read() has already been called
-
registerListener
Register a POIFSReaderListener for a document in the specified directory- Parameters:
listener- the listener to be registeredpath- the document path; if null, the root directory is assumedname- the document name- Throws:
NullPointerException- if listener is null or name is null or emptyIllegalStateException- if read() has already been called
-
main
read in files- Parameters:
args- names of the files- Throws:
IOException
-
processProperties
private void processProperties(BlockList small_blocks, BlockList big_blocks, Iterator properties, POIFSDocumentPath path) throws IOException - Throws:
IOException
-